Repository navigation
fix(ci): make gate PR dedup work for open PRs - #823
Conversation
belongs_to_pr used commits/{sha}/pulls, which returns [] for commits that
only exist on open PRs, so PR-wide dedup never fired and every re-approve
re-ran E2E/UT. Check pulls/{n}/commits instead.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6919def461
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| PR_COMMIT_SHAS=$(gh api \ | ||
| "repos/${REPO}/pulls/${PR_NUMBER}/commits?per_page=100" \ | ||
| --paginate --jq '.[].sha' 2>/dev/null || true) |
There was a problem hiding this comment.
Handle pull requests with more than 250 commits
For a PR with more than 250 commits, a candidate workflow run can have a head_sha omitted from PR_COMMIT_SHAS: GitHub's List commits on a pull request endpoint explicitly caps the result at 250 commits, so --paginate cannot retrieve the remainder. In the e2e-docker.yml approval → gate.yml duplicate-check path, belongs_to_pr then rejects that run and expensive E2E jobs can execute again despite an in-progress or successful run. This can be validated on a >250-commit PR by comparing the candidate run's head_sha with gh api "repos/$REPO/pulls/$PR/commits?per_page=100" --paginate --jq '.[].sha'; use an uncapped membership mechanism for omitted commits.
AGENTS.md reference: AGENTS.md:L12-L12
Useful? React with 👍 / 👎.
Summary
belongs_to_pr) usedGET /commits/{sha}/pulls, which returns[]for commits that only exist on open PRs.GET /pulls/{n}/commits(paginated), which correctly lists open-PR commits and still rejects SHAs from a reused branch name / foreign PR.Test plan
32322914975(1e6e4a8) is recognized → wouldshould_run=false.CI already passed for PR #N. Skipping.with downstream jobs skipped.