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