Skip to content

feat(env): add github-actions output format#500

Open
jongio wants to merge 1 commit into
mainfrom
idea/env-github-actions
Open

feat(env): add github-actions output format#500
jongio wants to merge 1 commit into
mainfrom
idea/env-github-actions

Conversation

@jongio

@jongio jongio commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Adds a --format github-actions option to azd app env so a service's resolved environment can be written straight into a workflow's $GITHUB_ENV file.

Why

Getting an app's resolved config into a GitHub Actions job today means hand-writing echo "KEY=value" >> $GITHUB_ENV lines or post-processing the dotenv output, and that breaks the moment a value spans multiple lines (PEM keys, certs, JSON blobs). GitHub Actions has a specific line format for that; this teaches env to emit it directly.

What

  • New format value github-actions for --format.
  • Single-line values render as KEY=value (no quoting, since the file is not shell-parsed).
  • Multiline values render with the KEY<<DELIM heredoc form. The delimiter is random (crypto/rand) and checked against the value so it can never collide with the content, which also closes the usual env-injection hole.
  • Works with --all (per-service # name headers are dropped so the stream stays valid) and with --write.
  • Masking still applies by default; use --no-mask when you actually want the values in the file.

Usage

azd app env api --format github-actions --no-mask >> $GITHUB_ENV

Tests

  • resolveEnvFormat accepts github-actions (case-insensitive) and its error text lists it.
  • formatGitHubEnv: sorted single-line output, no shell quoting of special characters, multiline heredoc round-trips the exact value with a non-colliding delimiter, masking applies first.
  • githubEnvDelimiter: never a substring of the value, randomized between calls.

Closes #495

Add a --format github-actions option to the env command so resolved variables can be piped straight into $GITHUB_ENV. Single-line values use KEY=value; values containing a newline use the KEY<<DELIM heredoc form with a random, collision-checked delimiter so multiline values (certs, keys) survive intact. Works with --all (headers are omitted to keep the output valid) and --write.

Closes #495

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 12, 2026
@jongio jongio self-assigned this Jul 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Website Preview

Your PR preview is ready!

📎 Preview URL: https://jongio.github.io/azd-app/pr/500/

This preview will be automatically cleaned up when the PR is closed.

github-actions Bot added a commit that referenced this pull request Jul 12, 2026
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.76%. Comparing base (dd00a47) to head (435eceb).

Files with missing lines Patch % Lines
cli/src/cmd/app/commands/env.go 60.00% 15 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #500      +/-   ##
==========================================
- Coverage   60.77%   60.76%   -0.01%     
==========================================
  Files         223      223              
  Lines       28527    28574      +47     
==========================================
+ Hits        17337    17364      +27     
- Misses      10010    10025      +15     
- Partials     1180     1185       +5     
Flag Coverage Δ
unittests 60.76% <60.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cli/src/cmd/app/commands/env.go 79.33% <60.00%> (-3.26%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Test This PR

A preview build (0.19.5-pr500) is ready for testing!

🌐 Website Preview

Live Preview: https://jongio.github.io/azd-app/pr/500/

One-Line Install (Recommended)

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.ps1) } -PrNumber 500 -Version 0.19.5-pr500"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.sh | bash -s 500 0.19.5-pr500

Uninstall

When you're done testing:

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.ps1) } -PrNumber 500"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.sh | bash -s 500

Build Info:

What to Test:
Please review the PR description and test the changes described there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add env --format github-actions for GITHUB_ENV output

1 participant