Repository navigation
DO-2055: improve extra env variable support - #204
Merged
Merged
Conversation
This will replace the env var handling in aio-app-deployment.yml and aws-cdk.yml, both of which fail when their input has a trailing newline. It additionally handles empty lines and comments starting with #. The previous loop handled the empty lines but not comments.
This replaces the manual loop in aio-app-deployment.yml and aws-cdk.yml with the export-env-vars composite action.
tmthrgd-aligent
requested review from
AdamJHall,
aaronmedina-dev and
crispy101
November 12, 2026 06:51
crispy101
reviewed
Nov 12, 2026
tmthrgd-aligent
force-pushed
the
fix/DO-2055_handle_trailing_env_newlines
branch
from
November 13, 2026 06:28
c87c44e to
328cd16
Compare
Values from AIO_DEPLOY_EXTRA_SECRETS and EXTRA_SECRETS were written to $GITHUB_ENV without being masked, so they could appear in later log output. Add a mask input to export-env-vars. When 'true', each value is masked before it is written to $GITHUB_ENV, so it is already masked when later steps list the environment in their log headers. Multiline (KEY<<DELIMITER) values are masked line by line. aio-app-deployment.yml and aws-cdk.yml now call the action twice: once for the variables, and once for the secrets with mask: true. This replaces the value2 input. The input is now passed to $GITHUB_ENV as is, apart from removing carriage returns (with a warning), so the runner handles the parsing, including multiline blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
node-pr had its own parser for ENV_VARS, duplicated in the build and test jobs. Replace it with export-env-vars, so all three workflows export extra environment variables the same way. ENV_VARS uses a legacy format that $GITHUB_ENV doesn't accept: any line that doesn't start a new KEY= continues the previous value. The new convert-legacy-env-vars action converts it to $GITHUB_ENV format by writing each variable as a KEY<<DELIMITER block with a random delimiter. KEY<<DELIMITER blocks already in the input are passed through, so ENV_VARS now also accepts anything $GITHUB_ENV does. The legacy multiline format still works but is deprecated and shows a warning. It can misread a base64 line ending in = padding as a new variable, cutting the value short; KEY<<DELIMITER blocks avoid this. Both actions are called with mask: true. The converted text is passed to export-env-vars through `with:`, where it no longer matches the original secret, so convert-legacy-env-vars masks every line of it. Other changes from the old parser: - Carriage returns are removed, with a warning, by export-env-vars. - Blank lines inside a multiline value are kept. - HAVE_SECRETS_ENV_VARS is removed. Both steps handle an empty ENV_VARS, so they no longer need a condition. Document the ENV_VARS format and update the SSH key example to use a KEY<<DELIMITER block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… docs ENV_VARS accepts the $GITHUB_ENV format plus the legacy continuation-line format, not exactly the $GITHUB_ENV format. In the legacy format, a line after a variable that isn't KEY=value continues that variable instead of failing. has-env-vars is already ignored by node-pr. Mark it as deprecated in the inputs table and remove it from the examples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runner decodes %0A and %0D in add-mask values, then masks the whole value and each of its lines, ignoring empty lines and trimming whitespace. So the converted output can be masked with one command instead of one per line. Skip masking when the output is empty or whitespace, as the runner warns about empty add-mask values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's yamllint step failed with line-length errors on the warning lines in convert-legacy-env-vars (251 characters) and export-env-vars (232), over the 120 character limit. Split each message across several lines. echo and awk's print both join their arguments with a space, so the warning text and its single-line output are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace printf '%s\n' "$INPUT_VALUE" | cmd with cmd <<< "$INPUT_VALUE" where the action input is fed to tr or awk. A here-string adds the same single trailing newline as printf '%s\n', so the input and output are unchanged, without the extra pipeline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
convert-legacy-env-vars: - Print the legacy format warning straight to stderr instead of routing it through fd 3. $(...) only captures awk's stdout, and the runner processes workflow commands on stderr as well as stdout. export-env-vars: - Remove CRs inside the mask awk instead of piping its input through tr. Remove the comments explaining that echo and print join their arguments with a space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…v-vars zizmor flags the $GITHUB_ENV write (code scanning alert 500), as input written there can set variables that run code in later steps, such as BASH_ENV, LD_PRELOAD or NODE_OPTIONS. Exporting caller-supplied variables is what the action is for, so suppress the finding and document the risk: in the action description, and above the write. The finding appeared after switching the write to a here-string. zizmor did not detect the same write at the end of a pipeline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AdamJHall
requested changes
Nov 16, 2026
AdamJHall
left a comment
Contributor
There was a problem hiding this comment.
Looks good, one minor change to invert the mask variable just to be extra safe.
Defaulting mask to 'false' meant forgetting it silently left secrets unmasked. Make mask required on export-env-vars and convert-legacy-env-vars, so every caller has to choose. The runner doesn't enforce required inputs (a missing input is an empty string), so both actions now fail unless mask is 'true' or 'false'. This also catches typos such as 'ture'. The variables calls in aio-app-deployment.yml and aws-cdk.yml now pass mask: false. The secrets calls and node-pr already pass mask: true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AdamJHall
previously approved these changes
Nov 16, 2026
AdamJHall
approved these changes
Nov 17, 2026
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.
Description of the proposed changes
Context
aio-app-deployment.ymlandaws-cdk.ymlfailed when their extra env var inputs ended with a newline, and extra secrets weren't masked.node-pr.ymlhad its own copy of this logic, with its own problems: it kept CRs and misread some base64 lines as new variables.Changes
Move extra env var handling into composite actions shared by all three workflows.
export-env-vars. It writes its input to$GITHUB_ENVand lets the runner parse it, soKEY=VALUElines andKEY<<DELIMITERblocks work and blank lines are ignored. It removes CRs with a warning, and withmask: trueit masks values before they are written.aio-app-deployment.ymlandaws-cdk.yml, withmask: truefor the secrets.convert-legacy-env-varsto convert node-pr'sENV_VARSformat to$GITHUB_ENVformat. Use it innode-pr.ymlin place of the old parser. The legacy multiline format still works but shows a deprecation warning.Test
aio-app-deployment.ymloraws-cdk.ymlwith an extra secret that ends with a newline. The deploy should succeed, with the secret values masked in the log.node-pr.ymlwith a multilineENV_VARSin the legacy format, saved with CRLF line endings. The values should be exported and masked, with warnings about the legacy format and the CRs.Screenshots (if applicable)
Other solutions considered (if any)
Notes to PR author
Notes to reviewers
Time Tracking
DO-2055: code review, select projectDev OpsTeam🤖 Generated with Claude Code