Conversation
…AGE to $GITHUB_OUTPUT instead of echo since embedded quotes in the error message cause the shell to mis-interpret them For example, in https://github.com/firebase/firebase-js-sdk/actions/runs/7586489122/job/20664769245?pr=7952 the following error occurred, which this commit fixes: ``` $ /home/runner/work/firebase-js-sdk/firebase-js-sdk/node_modules/.bin/ts-node-script scripts/ci/check_changeset.ts /home/runner/work/firebase-js-sdk/firebase-js-sdk/node_modules/child-process-promise/lib/index.js:33 var cpError = new ChildProcessError(err.message, err.code, child_process, stdout, stderr); ^ ChildProcessError: Command failed: echo "CHANGESET_ERROR_MESSAGE=- Changeset formatting error in following file:%0A \`\`\`%0A Some packages have been changed but no changesets were found. Run \`changeset add\` to resolve this error.%0A If this change doesn't need a release, run \`changeset add --empty\`.%0A \`\`\`%0A" >> $GITHUB_OUTPUT /bin/sh: 1: Syntax error: Unterminated quoted string \`echo "CHANGESET_ERROR_MESSAGE=- Changeset formatting error in following file:%0A \`\`\`%0A Some packages have been changed but no changesets were found. Run \`changeset add\` to resolve this error.%0A If this change doesn't need a release, run \`changeset add --empty\`.%0A \`\`\`%0A" >> $GITHUB_OUTPUT\` (exited with error code 2) at callback (/home/runner/work/firebase-js-sdk/firebase-js-sdk/node_modules/child-process-promise/lib/index.js:33:27) at ChildProcess.exithandler (node:child_process:410:5) at ChildProcess.emit (node:events:513:28) at ChildProcess.emit (node:domain:489:12) at maybeClose (node:internal/child_process:1100:16) at Socket.<anonymous> (node:internal/child_process:458:11) at Socket.emit (node:events:513:28) at Socket.emit (node:domain:489:12) at Pipe.<anonymous> (node:net:301:12) { code: 2, childProcess: { _forkChild: [Function: _forkChild], ChildProcess: [Function: ChildProcess], exec: [Function: exec], execFile: [Function: execFile], execFileSync: [Function: execFileSync], execSync: [Function: execSync], fork: [Function: fork], spawn: [Function: spawn], spawnSync: [Function: spawnSync] }, stdout: '', stderr: '/bin/sh: 1: Syntax error: Unterminated quoted string\n' } error Command failed with exit code 1. ```
…interpolation of special characters in CHANGESET_ERROR_MESSAGE This fixes the following error in the "Print changeset checker output" step: ``` /home/runner/work/_temp/05ad4244-c741-4473-b5fa-88197e013f3c.sh: line 1: fg: no job control /home/runner/work/_temp/05ad4244-c741-4473-b5fa-88197e013f3c.sh: command substitution: line 1: unexpected EOF while looking for matching `'' /home/runner/work/_temp/05ad4244-c741-4473-b5fa-88197e013f3c.sh: command substitution: line 2: syntax error: unexpected end of file /home/runner/work/_temp/05ad4244-c741-4473-b5fa-88197e013f3c.sh: line 1: .%0A: command not found - Changeset formatting error in following file:%0A changeset addchangeset add --empty%0A ``` e.g. https://github.com/firebase/firebase-js-sdk/actions/runs/7586786834/job/20665754718
|
…i/check_changeset.ts since they have been moved to a separate PR (#7964)
Size Report 1Affected ProductsNo changes between base commit (49c7903) and merge commit (a82dcf2).Test Logs |
Size Analysis Report 1Affected ProductsNo changes between base commit (49c7903) and merge commit (a82dcf2).Test Logs |
| const githubOutputFile = (function (): string { | ||
| const value = process.env.GITHUB_OUTPUT; | ||
| if (!value) { | ||
| throw new Error('GITHUB_OUTPUT environment variable must be set'); |
There was a problem hiding this comment.
Out of curiosity, what was the case where GITHUB_OUTPUT was not set? Is this for local testing? With this error does it get far enough in local testing for the output to be useful?
There was a problem hiding this comment.
I never encountered that. I just added that check so that the TypeScript compiler would type githubOutputFile as string instead of string | undefined.
There was a problem hiding this comment.
The later call to writeFile(githubOutputFile, ...) will fail to compile if githubOutputFile is string | undefined; however, it compiles fine if it is string.
Here is an example of this change causing the workflow to correctly report the results:
Before
From https://github.com/firebase/firebase-js-sdk/actions/runs/7586489122/job/20664769245
After
From https://github.com/firebase/firebase-js-sdk/actions/runs/7587195474/job/20666981441