feat(env): add github-actions output format#500
Open
jongio wants to merge 1 commit into
Open
Conversation
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]>
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. |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
🚀 Test This PRA preview build ( 🌐 Website PreviewLive 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-pr500UninstallWhen 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 500Build Info:
What to Test: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
--format github-actionsoption toazd app envso a service's resolved environment can be written straight into a workflow's$GITHUB_ENVfile.Why
Getting an app's resolved config into a GitHub Actions job today means hand-writing
echo "KEY=value" >> $GITHUB_ENVlines 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 teachesenvto emit it directly.What
github-actionsfor--format.KEY=value(no quoting, since the file is not shell-parsed).KEY<<DELIMheredoc 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.--all(per-service# nameheaders are dropped so the stream stays valid) and with--write.--no-maskwhen you actually want the values in the file.Usage
Tests
resolveEnvFormatacceptsgithub-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