Repository navigation
Make the PDF commit step survive a push race - #14
Merged
Merged
Conversation
The step pushes without rebasing, so when two commits land close together one run builds the PDF and then loses the push, failing the whole build. Creating a repo from this template hits it immediately: the initial commit and the author's first real commit both trigger a build, and one of them goes red on a brand new repo. Rebase and retry, and add a concurrency group so a newer push supersedes an in-flight build, which keeps the committed PDF in step with the newest paper.md rather than letting whichever build finishes last win. Also stop running `git push` when there was nothing to commit: in `A && B || C && D`, a successful A short-circuits past C but still runs D, so the previous chain pushed even after reporting "No changes to PDF". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
PDF Preview ReadyThe PDF has been generated successfully. Download it from the Actions artifacts. |
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit PDF to repositorypushes without rebasing, so two commits landing close together make one build fail after it has already generated the PDF.This is not a rare race. Creating a repository from this template triggers it immediately: the template's initial commit starts a build, and the author's first real commit starts another. One of the two loses the push and goes red on a brand-new repo, which is an alarming first impression. It also fires whenever an author pushes twice in quick succession.
Observed on a fresh repo created from this template:
Changes
Rebase and retry rather than pushing once and failing.
A concurrency group with
cancel-in-progress, so a newer push supersedes an in-flight build. Without it, retrying alone would fix the red X but leave a worse problem: two builds racing to commit means whichever finishes last wins, which can leavepaper.pdfbuilt from an olderpaper.md.Do not push when there was nothing to commit. The previous line was:
Since
A && B || C && Dgroups as((A && B) || C) && D, a successfulgit diff --cached --quietshort-circuits past the commit but still reachesgit push. Harmless in practice, but it meant the step pushed after reporting "No changes to PDF".Verification
Tested on a repo using this workflow by pushing two commits 11 seconds apart, which is the exact scenario that used to fail:
cancelledby the concurrency group and the later run pushed cleanly on its first attempt (4d687c7..774d478 main -> main)Also confirmed the no-op path still reports "No changes to PDF" and exits 0 when the PDF is unchanged.
🤖 Generated with Claude Code