chore(scripts): stop the assignment capture at the closing quote (#2146)

Copilot, eighth review: the bare-value pattern ran to whitespace, so a QUOTED
assignment swallowed the closing quote — `echo "SMOKE_BROWSER=chromium" >>
$GITHUB_ENV` captured `chromium"`, which is not `chromium`, and the guard
rejected a PERMITTED assignment. A false positive on the allowed value is the
worse direction to be wrong in: it fails a workflow that is doing the right
thing, and there is no way to satisfy the guard except to stop using the
supported spelling.

The value is now a quoted string or a bare run stopping at a quote or a `;`
(PowerShell's separator), so all three dialects unwrap the same way.
Regression cases for the permitted quoted `chromium` in $GITHUB_ENV, in a
cmd-style `set`, and single-quoted in PowerShell — each paired with the
firefox spelling that must still fail.

Signed-off-by: Cliff Hall <cliff@futurescale.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-27 02:06:59 -04:00
commit 53e773d70e

View file

@ -237,6 +237,30 @@ describe("findWorkflowViolations", () => {
),
rules: [VIOLATION.BROWSER_ENV],
},
{
// Copilot, eighth review: the bare-value pattern used to run to
// whitespace, so a QUOTED assignment captured the closing quote —
// rejecting a permitted `chromium`. A false positive on the allowed value
// fails a workflow that is doing the right thing, which is the worse
// direction to be wrong in.
name: "allows a quoted chromium appended to $GITHUB_ENV",
text: workflow(
' - run: echo "SMOKE_BROWSER=chromium" >> $GITHUB_ENV',
),
rules: [],
},
{
name: "allows a quoted chromium in a cmd-style set",
text: workflow(' - run: set "SMOKE_BROWSER=chromium"'),
rules: [],
},
{
name: "allows a single-quoted chromium in PowerShell",
text: workflow(
" - run: $env:SMOKE_BROWSER = 'chromium'; npm run smoke",
),
rules: [],
},
{
// cmd's `set NAME=value` and the GitHub-native `>> $GITHUB_ENV` append
// both carry the POSIX `NAME=value` substring, so one pattern covers all