fix: correct quoting in release workflow version extraction #5

Merged
Copilot merged 2 commits from copilot/fix-package-json-quote-syntax into main 2026-02-27 22:45:16 +00:00
Copilot commented 2026-02-27 22:43:38 +00:00 (Migrated from github.com)

Escaped double quotes inside $(...) caused bash to interpret require(...) as a subshell, producing a syntax error in the "Read version from package.json" step.

Change

Swap quote layers so single quotes wrap the node -p expression:

- run: echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
+ run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
Original prompt

The "Read version from package.json" step in .github/workflows/release.yml (line 56) fails with a bash syntax error:

/home/runner/work/_temp/0ef6147a-c318-4211-bb39-8d0d2c8364c9.sh: line 1: syntax error near unexpected token `('

The problem is the quoting on line 56. The escaped double quotes inside $(...) confuse bash because the parentheses in require(...) get interpreted by the shell.

Fix: Change line 56 from:

run: echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"

To:

run: echo "version=$(node -p 'require(\"./package.json\").version')" >> "$GITHUB_OUTPUT"

Swap the quote layers — use single quotes around the node -p expression so bash doesn't try to interpret require(...) as a subshell. Only this one line in .github/workflows/release.yml needs to change.

This pull request was created from Copilot chat.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Escaped double quotes inside `$(...)` caused bash to interpret `require(...)` as a subshell, producing a syntax error in the "Read version from package.json" step. ## Change Swap quote layers so single quotes wrap the `node -p` expression: ```diff - run: echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT" + run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT" ``` <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > The "Read version from package.json" step in `.github/workflows/release.yml` (line 56) fails with a bash syntax error: > > ``` > /home/runner/work/_temp/0ef6147a-c318-4211-bb39-8d0d2c8364c9.sh: line 1: syntax error near unexpected token `(' > ``` > > The problem is the quoting on line 56. The escaped double quotes inside `$(...)` confuse bash because the parentheses in `require(...)` get interpreted by the shell. > > **Fix:** Change line 56 from: > ```yaml > run: echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT" > ``` > > To: > ```yaml > run: echo "version=$(node -p 'require(\"./package.json\").version')" >> "$GITHUB_OUTPUT" > ``` > > Swap the quote layers — use single quotes around the node `-p` expression so bash doesn't try to interpret `require(...)` as a subshell. Only this one line in `.github/workflows/release.yml` needs to change. </details> <!-- START COPILOT CODING AGENT SUFFIX --> *This pull request was created from Copilot chat.* > <!-- START COPILOT CODING AGENT TIPS --> --- 🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security)
Sign in to join this conversation.
No description provided.