fix(altdoc): key PR-build concurrency group by PR number, not run_id - #537
Conversation
Fixes #306, #311. altdoc-multiversion-docs.yml's docs job keyed its concurrency group by github.run_id for PR events, which is unique per run -- so cancel-in-progress could never fire for a PR's own superseded runs. Several full renders raced to deploy to the same pr-preview/pr-<N>/ path on gh-pages, sometimes leaving it mid-rebase (add/add conflicts from JamesIves/github-pages-deploy-action) and sometimes letting an older commit's run finish last and overwrite a newer commit's preview. Now keyed by the PR number instead, matching this workflow's pre-migration behavior in its source repos: different PRs still build concurrently, but a newer push to the same PR cancels that PR's still-running build. Checked preview.yml and preview-deploy.yml (per #311's suggestion) for the same shape -- both already key on a stable per-branch/per-PR value (github.ref and head_repository.id+head_branch respectively), not run_id, so neither has this bug. Out of scope for this PR: #311's third acceptance criterion (porting the same fix to d-morrison/rpt's bespoke docs.yaml) is a different repo. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Working on this --- paws off until I'm done. |
|
Claude finished review — View run All CI green except Code Review — PR #537 (
|
Closes #306
Closes #311
Summary
altdoc-multiversion-docs.yml'sdocsjob keyed its concurrency group bygithub.run_idforpull_requestevents. Sincerun_idis unique per run, every run landed in its own group, socancel-in-progress: truecould never fire for a PR's own superseded runs. Two independent issues observed the same underlying bug from different angles:pr-preview/pr-<N>/path -- the sticky preview comment ended up reflecting whichever run finished last, not necessarily the newest commit.JamesIves/github-pages-deploy-action's rebase-onto-gh-pagespublish hitadd/addmerge conflicts across ~22 files, producing a reddocscheck unrelated to the PR's actual diff.Both issues independently suggested the identical fix: key the group by PR number instead.
Fix
This matches the pre-migration behavior in both source repos (
UCD-SERG/serocalculator's andd-morrison/rpt's bespoke workflows both keyed on the PR number), so it's a regression fix rather than a new requirement --cancel-in-progresswas alreadytrueand needed no other change.Checked per #311's suggestion
preview.ymlandpreview-deploy.ymlfor the samerun_id-keyed shape -- neither has it.preview.ymlkeys ongithub.ref(stable per-branch) andpreview-deploy.ymlkeys onhead_repository.id+head_branch(also stable per-branch, withcancel-in-progress: falseby design). This bug was isolated toaltdoc-multiversion-docs.yml.Out of scope
#311's third acceptance criterion -- porting the same fix to
d-morrison/rpt's bespokedocs.yaml-- is a different repository, not addressed here.Testing
python3 -c "import yaml; yaml.safe_load(...)"-- valid.actionlint-- zero new warnings (same 36 pre-existingSC2086hits as before this change, at shifted line numbers).concurrency:group key isn't something_selftest.ymlcan exercise (it requires genuinely concurrent real runs, which a single selftest job can't simulate) -- no other workflow's concurrency group in this repo has test coverage either, so this isn't a coverage regression.check-new-line-breaksandcheck-non-standard-chars.py-- clean on the changelog fragment.🤖 Generated with Claude Code