ci: retry the generated-docs push through a rebase on rejection

build-docs's auto-commit step was seen rejected as non-fast-forward
(run 976, sha 3bbda31): npm ci + astro build + the Cloudflare Pages
deploy ahead of it can take several minutes, long enough for another
PR to merge into main first. A bare `git push` has no way to recover
from that -- the whole job just fails, even though every real step
(tests, manual verification, man page, site build, deploy) already
succeeded.

This commit only ever touches three generated files
(fish-config.md/.1, the component registry), so a rebase onto
whatever landed is always mechanical -- retry push up to 3 times,
rebasing onto origin/main between attempts. Ends on an explicit
`test "$pushed" -eq 1` rather than trailing off the for loop, so a
run that exhausts all three retries still fails loudly instead of
reporting success.
This commit is contained in:
2026-09-22 22:54:47 -04:00
parent 17a95abebe
commit 35a48ac868
+19 -1
View File
@@ -181,7 +181,25 @@ jobs:
git add docs/fish-config.md docs/fish-config.1 conf.d/__fish_config_op_registry.fish
git diff --cached --quiet && echo "No changes to commit" && exit 0
git commit -m "chore(docs): regenerate manual, man page, and component registry"
git push
# npm ci + astro build + the Cloudflare deploy above can take
# several minutes, so main can move (another PR merges) before
# this push lands -- a bare `git push` was seen rejected as
# non-fast-forward for exactly that reason (run 976). This
# commit only ever touches generated files, so a rebase onto
# whatever landed is always mechanical; retry it a few times
# against a live race instead of failing the whole job.
pushed=0
for attempt in 1 2 3; do
if git push; then
pushed=1
break
fi
echo "push rejected (attempt $attempt/3), rebasing onto origin/main..." >&2
git fetch origin main
git rebase origin/main
done
test "$pushed" -eq 1
# Stand-in for the GitHub mirror so the commit gets a completed status
# instead of the real jobs above sitting queued forever for a