From df80dc1792047871fd5d4ad5162fb2a53c2c5d44 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sun, 4 Oct 2026 12:00:47 +0100 Subject: [PATCH] fix(ci): retry the docs push after a rejected ref Several releases push casks to this tap at the same time. The docs job then pushed on top of a ref that had moved, and GitHub rejected it with "cannot lock ref". The job now rebases and retries. If the rebase fails it resets to the remote, regenerates the page and pushes again. A concurrency group keeps two docs runs from overlapping. --- .github/workflows/docs.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4fb1e32..cd3a55b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,6 +16,10 @@ permissions: pages: write id-token: write +concurrency: + group: update-docs + cancel-in-progress: false + jobs: update-docs: runs-on: ubuntu-latest @@ -46,7 +50,22 @@ jobs: git config --local user.name "github-actions[bot]" git add docs/ git commit -m "docs: auto-update documentation from casks" - git push + for attempt in 1 2 3 4; do + if git pull --rebase origin main; then + git push && exit 0 + else + git rebase --abort || true + git reset --hard origin/main + ./scripts/generate-docs.sh + git diff --quiet docs/index.html && exit 0 + git add docs/ + git commit -m "docs: auto-update documentation from casks" + git push && exit 0 + fi + sleep $((attempt * 5)) + done + echo "could not push after 4 attempts" >&2 + exit 1 deploy-pages: needs: update-docs