Skip to content

Fix changed-file detection, which was linting nothing - #1356

Merged
CallumWalley merged 1 commit into
mainfrom
ci/fix-changed-file-detection
Jul 29, 2026
Merged

Fix changed-file detection, which was linting nothing#1356
CallumWalley merged 1 commit into
mainfrom
ci/fix-changed-file-detection

Conversation

@thomasbergernz

Copy link
Copy Markdown
Contributor

Summary

Every per-file check in checks.yml has been passing without looking at a single file. From the Determine what files to check job on #1355:

fatal: ambiguous argument 'origin/...HEAD': unknown revision or path not in the working tree.
::info::Workflow triggered by PR
Changed files: ''

and then, in Check page meta:

No files to check meta on.

Cause. github.base_ref is only populated on pull_request events. This workflow triggers on push (branches-ignore: [main]) and has no pull_request trigger at all, so base_ref is always empty. The revision in

git diff --name-only origin/${{ github.base_ref }}...HEAD

becomes the literal origin/...HEAD, the diff fails, and changed_files comes back empty. Each dependent job then hits its if: ${{! needs.get.outputs.filelist}} branch and exits 0.

So Check Spelling, Check Prose, Check Markdown, Check page meta and Check slurm scripts have been green without running. Only Test build was doing real work. The ::info::Workflow triggered by PR line printed unconditionally, so the log asserted a trigger that hadn't happened.

Fix

Fall back to the repository default branch when base_ref is empty, and fail the step outright if the base ref can't be resolved. Silently linting nothing is worse than a red job, because it reads as a pass — that's what let this sit unnoticed.

The base is passed through env: rather than interpolated into the script.

Verification

Run locally against #1355, which changes 167 pages:

$ git diff --name-only "origin/main...origin/docs/add-missing-page-descriptions" | grep -E '^docs/.*\.md$' | wc -l
167

The old command yields an empty list on the same branch. The no-docs-changed case still works — grep finding no matches no longer aborts the step under bash -e.

Note this PR changes no docs/*.md, so its own run will legitimately report an empty list. The fix is exercised for real by the next PR that touches documentation.

Scope

Only the push and repository_dispatch paths were affected. The workflow_dispatch path supplies fileList explicitly and is unchanged.

Heads up that once this lands, PRs may start surfacing lint findings on pages that have never actually been checked.

🤖 Generated with Claude Code

Every per-file check in this workflow has been passing without looking at a
single file:

    fatal: ambiguous argument 'origin/...HEAD': unknown revision or path
    ::info::Workflow triggered by PR
    Changed files: ''

`github.base_ref` is only populated on pull_request events. This workflow
triggers on push (`branches-ignore: [main]`) and has no pull_request trigger,
so base_ref is always empty, the revision becomes the literal `origin/...HEAD`,
and the diff fails. The empty file list then makes Check Spelling, Check
Prose, Check Markdown, Check page meta and Check slurm scripts each skip to a
green "no files to check". Only Test build was doing real work. The
`::info::Workflow triggered by PR` line printed unconditionally, so the log
asserted a trigger that had not happened.

Fall back to the repository default branch when base_ref is empty, and fail
the step outright if that ref cannot be resolved. Silently linting nothing is
worse than a red job, because it reads as a pass.

Verified against #1355, which changes 167 pages: the old command yields an
empty list, the new one yields all 167. The empty case still works too - grep
finding no matches no longer aborts the step under `bash -e`.

Only reachable via push and repository_dispatch; the workflow_dispatch path
supplies `fileList` explicitly and is unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Test deployment successful!! (2026-07-29T09:54:55Z)
Preview available at https://callumwalley.github.io/mkdocs-demo-deploy/nesi/support-docs/ci/fix-changed-file-detection

See all deployed demo sites

@CallumWalley
CallumWalley merged commit f835490 into main Jul 29, 2026
8 of 9 checks passed
@CallumWalley
CallumWalley deleted the ci/fix-changed-file-detection branch July 29, 2026 21:49
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