fix: prevent stale README automation branch pushes#2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cb831a005
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| git fetch origin main --depth=1 | ||
|
|
||
| git checkout -B "$BRANCH" origin/main | ||
|
|
||
|
|
||
| git apply --index "$PATCH_FILE" |
There was a problem hiding this comment.
Recompute README patch after switching to origin/main
This step computes a patch from the initial checkout (git diff ... > "$PATCH_FILE") and then resets the branch to a freshly fetched origin/main before applying it; if main advances during the run (especially with changes touching profile/README.md), git apply --index can fail and, with set -euo pipefail, the workflow aborts instead of updating the automation PR. This regression is introduced by rebasing to a newer base without regenerating the README/diff from that base.
Useful? React with 👍 / 👎.
Fixes stale GitHub Actions pushes for the automated profile README branch by rebuilding the automation branch from origin/main, preserving the generated README diff, fetching the remote automation ref before push, and retrying with an explicit force-with-lease.