Skip to content

Comments

Fix CodeQL workflow: invalid matrix context in job-level if condition#406

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/investigate-codeql-workflows
Draft

Fix CodeQL workflow: invalid matrix context in job-level if condition#406
Copilot wants to merge 2 commits intomainfrom
copilot/investigate-codeql-workflows

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

CodeQL has been failing since Dec 21, 2025 with 0 jobs on every run — GitHub's signature for a workflow parse/validation error, not a job failure.

Two sequential bugs introduced the breakage:

  • PR Refactor CodeQL workflow to use exclude_paths #82 replaced paths-ignore with exclude_paths, which is not a valid GitHub Actions key
  • A subsequent "fix" corrected that but introduced a new invalid pattern — referencing matrix.* in a job-level if condition:
# INVALID: matrix context is not available at jobs.<job_id>.if
analyze:
  needs: detect
  if: matrix.language != 'python' || needs.detect.outputs.python_changed == 'true'

GitHub Actions only allows matrix.* in step-level if and a few other specific contexts — not jobs.<job_id>.if. This causes an immediate parse failure: Unrecognized named-value: 'matrix'.

Changes:

  • Removed the detect job (which existed solely to feed the broken conditional)
  • Removed needs: detect and the invalid if condition from analyze
  • The paths: trigger (the valid replacement for paths-ignore) is preserved

All three language analyses (actions, javascript-typescript, python) now run unconditionally when the path filter triggers the workflow.


🔒 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.

The CodeQL workflow has been failing since Dec 21, 2025 with 0 jobs due
to a workflow validation error. The analyze job had:

  if: matrix.language != 'python' || needs.detect.outputs.python_changed == 'true'

The matrix context is NOT available in jobs.<job_id>.if conditions in
GitHub Actions, causing: 'Unrecognized named-value: matrix'

Fix: Remove the detect job and the invalid if condition from analyze job.
All three language analyses (actions, javascript-typescript, python) will
now run whenever the paths trigger fires.

Co-authored-by: MightyPrytanis <219587333+MightyPrytanis@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate potential issues with CodeQL workflows Fix CodeQL workflow: invalid matrix context in job-level if condition Feb 23, 2026
Copilot AI requested a review from MightyPrytanis February 23, 2026 15:06
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.

2 participants