Skip to content

ci: detect changed paths with git instead of the listFiles API - #1242

Merged
thiras merged 1 commit into
mainfrom
ci/paths-filter-git-diff
Jul 16, 2026
Merged

thiras merged 1 commit into
mainfrom
ci/paths-filter-git-diff

Conversation

@thiras

@thiras thiras commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Problem

detect changes asked GitHub's pulls/{n}/files endpoint which paths changed, via dorny/paths-filter. That endpoint is a single point of failure for the entire pipeline: when it 503s, the job dies in 8s, every downstream job (clippy, test, rustfmt, the whole Solidity suite) reports skipping, and the ci-success alls-green gate fails — producing a red PR in which nothing ever compiled.

This is live right now, and it is what blocked #1237:

  • GitHub serves its "Unicorn!" HTML error page for /pulls/{n}/files — the action gets HTML where it expects JSON and logs ##[error]<!DOCTYPE html>.
  • Not branch-specific: already-merged PR refactor(node): delete the dormant confirmations knob (#1227) #1235 reproduces it identically.
  • Not throttling: rate limit untouched at 4975/5000.
  • Not transient: re-running the failed jobs reproduced it in 8s; it has been down for 20+ minutes with githubstatus.com still showing "All Systems Operational".

No re-run could ever have cleared this, because nothing was wrong with the code.

Fix

token: '' — the action's own documented switch. Its warning text reads "set token: '' to detect changes using git diff against 'base'". git kept working throughout the REST outage.

Semantics are unchanged, not merely close

Verified against the action's source (main.ts, git.ts):

  • actions/checkout leaves a PR on the merge commit, so git diff base..HEAD is the PR's effective diff — exactly what listFiles returned.
  • Both paths decompose renames into add + delete: the API does it explicitly to mimic rename detection being off, which the git path passes literally as --no-renames.
  • ensureRefAvailable self-fetches the base SHA (fetch --depth=1 origin <sha>), so the default shallow checkout still resolves it — no fetch-depth bump needed.
  • The push path already used git. This makes both event types agree rather than diverge by trigger.

pull-requests: read existed solely for that API call, so it is dropped.

Verification

This PR is its own test. It was opened while the endpoint was still returning 503 — confirmed at push time. If detect changes goes green here, the fix is demonstrated against the exact outage it targets, not a simulation of one.

The risk worth reviewing is silent under-triggering — a detector that wrongly reports "no rust changed" would skip test/clippy and let alls-green pass. Check the detect changes log below for the resolved filter outputs: this PR touches only .github/workflows/ci.yml, which the rust, adr, and solidity filters all list, so all three must come out true and the full suite must run.

No CHANGELOG entry: CI-internal, no operator-facing surface (cf. 5cfbaea).

🤖 Generated with Claude Code

`detect changes` called GitHub's pulls/{n}/files endpoint via
dorny/paths-filter to decide which jobs run. That endpoint is a single
point of failure for the whole pipeline: when it 503s this job dies in
8s, every downstream job reports `skipping`, and the `ci-success`
alls-green gate fails — a red PR in which nothing ever compiled.

Not hypothetical. It blocked #1237 today: GitHub served its "Unicorn!"
HTML error page for /pulls/{n}/files repo-wide, an already-merged PR
reproduced it identically (so it was not branch-specific), and the rate
limit was untouched at 4975/5000 (so it was not throttling). Re-running
the failed jobs reproduced it in 8s. No re-run could ever have cleared
it, because nothing was wrong with the code.

`token: ''` is the action's own documented switch for this — its warning
text reads "set token: '' to detect changes using git diff against
'base'". git kept working throughout the REST outage.

Semantics are unchanged, not merely close:

- `actions/checkout` leaves a PR on the merge commit, so paths-filter's
  `git diff base..HEAD` is the PR's effective diff — exactly what
  listFiles returned.
- Both sides decompose renames into add + delete: the API does it
  explicitly to mimic rename detection being off, which the git path
  passes literally as `--no-renames`.
- `ensureRefAvailable` self-fetches the base SHA (`fetch --depth=1
  origin <sha>`), so the default shallow checkout still resolves it and
  no fetch-depth bump is needed.
- The `push` path already used git; this makes both events agree rather
  than diverge by trigger.

`pull-requests: read` existed solely for that API call, so it is dropped.

No CHANGELOG entry: CI-internal with no operator-facing surface, per
5cfbaea.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 16, 2026 23:10
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@thiras
thiras merged commit 4dc4569 into main Jul 16, 2026
22 of 23 checks passed
@thiras
thiras deleted the ci/paths-filter-git-diff branch July 16, 2026 23:20
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