Skip to content

fix(ci): prevent JS syntax error when workflow dispatch inputs contain special characters#1029

Merged
Wikid82 merged 2 commits into
mainfrom
hotfix/ci
May 19, 2026
Merged

fix(ci): prevent JS syntax error when workflow dispatch inputs contain special characters#1029
Wikid82 merged 2 commits into
mainfrom
hotfix/ci

Conversation

@Wikid82
Copy link
Copy Markdown
Owner

@Wikid82 Wikid82 commented May 19, 2026

Summary

Fixes a SyntaxError: Unexpected identifier 't' that aborted the weekly nightly promotion workflow when manually triggered with a reason containing an apostrophe (e.g. "didn't run as scheduled").

Root Cause

GitHub Actions substitutes ${{ }} expressions before the JavaScript source is parsed. User-controlled and job-output values were interpolated directly into single-quoted JS string literals inside github-script steps. Any apostrophe in those values terminated the string early, causing a parse error that killed the entire job.

Fix

All affected values are moved to the step-level env: block and read via process.env.* in the script body. Values are delivered as runtime environment variables and never evaluated as JavaScript source code.

Three injection points secured:

  • inputs.skip_workflow_checkcheck-nightly-health job
  • inputs.reasoncreate-promotion-pr job, Create Promotion PR step
  • needs.check-nightly-health.outputs.failure_reason + .latest_run_urlnotify-on-failure job, Create Failure Issue step

Validation

  • yamllint: ✅ no errors
  • actionlint: ✅ no errors
  • Full expression audit: zero remaining user-controlled inputs.* values in JS string literals
  • Supervisor reviewed: ✅ APPROVED
  • QA Security audit: ✅ PASS

Testing

Manual test plan: docs/issues/issue-1022-manual-test-plan.md

To verify: manually trigger weekly-nightly-promotion.yml with reason "didn't run as scheduled" — the job should complete without a SyntaxError.

Fixes #1022

Wikid82 and others added 2 commits May 19, 2026 06:43
…n special characters

The weekly promotion workflow injected user-controlled and job-output
values directly into JavaScript string literals inside github-script
steps. Any apostrophe in those values (e.g. "didn't run as scheduled")
would terminate the string literal early, producing a SyntaxError that
aborted the entire promotion job.

Move all three affected values to the step-level env: block and read
them via process.env.* in the script body. This ensures values are
delivered as runtime environment variables and never evaluated as
JavaScript source code, regardless of their content.

Three inputs secured:
- inputs.skip_workflow_check (check-nightly-health job)
- inputs.reason (create-promotion-pr job, Create Promotion PR step)
- needs.check-nightly-health.outputs.failure_reason and .latest_run_url
  (notify-on-failure job, Create Failure Issue step)

Fixes #1022
Copilot AI review requested due to automatic review settings May 19, 2026 11:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the weekly nightly promotion workflow against JavaScript parse failures caused by special characters in workflow dispatch inputs.

Changes:

  • Moves affected workflow values into step-level environment variables before reading them in github-script.
  • Adds/updates QA and planning documentation for issue #1022.
  • Adds a manual validation plan for the workflow dispatch regression.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.github/workflows/weekly-nightly-promotion.yml Passes dispatch inputs and dynamic outputs through env before JavaScript use.
docs/issues/issue-1022-manual-test-plan.md Adds manual regression scenarios for special-character dispatch reasons.
docs/plans/current_spec.md Replaces the active spec with the issue #1022 workflow injection plan.
docs/reports/qa_report.md Replaces the QA report with the final audit for this workflow fix.
docs/reports/qa_report_2026-05-19_issue1022.md Adds an earlier audit report for issue #1022.

Comment thread docs/reports/qa_report_2026-05-19_issue1022.md
Comment thread docs/issues/issue-1022-manual-test-plan.md
Comment thread docs/plans/current_spec.md
Comment thread docs/plans/current_spec.md
Comment thread docs/reports/qa_report.md
@github-advanced-security
Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-actions
Copy link
Copy Markdown
Contributor

✅ Supply Chain Verification Results

PASSED

📦 SBOM Summary

  • Components: 1487

🔍 Vulnerability Scan

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 4
🟢 Low 2
Total 6

📎 Artifacts

  • SBOM (CycloneDX JSON) and Grype results available in workflow artifacts

Generated by Supply Chain Verification workflow • View Details

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Wikid82 Wikid82 merged commit 6d74500 into main May 19, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚨 Weekly Promotion Failed: PR Creation Error

4 participants