From 9f15471fc8232ec2471b3cfe2b7adb47cacc38f1 Mon Sep 17 00:00:00 2001 From: Andy Jost Date: Wed, 16 Sep 2026 13:55:09 -0700 Subject: [PATCH] ci: rebase concurrent gh-pages deployments instead of force-pushing Every PR preview, the main docs deploy and the coverage deploy commit to the shared gh-pages branch. The deploy action force-pushes by default, so when two jobs overlap the second push is not a fast-forward. The "Protect gh-pages" ruleset rejects such pushes, and the second job fails; before the ruleset the force-push silently discarded the other job's commit. Each deploy touches only its own folder, so with force: false the action fetches, rebases its commit onto the new tip and retries, up to three attempts, without overwriting anything. Co-authored-by: Claude Fable 5.1 --- .github/actions/doc_preview/action.yml | 6 ++++++ .github/workflows/build-docs.yml | 3 +++ .github/workflows/coverage.yml | 3 +++ 3 files changed, 12 insertions(+) diff --git a/.github/actions/doc_preview/action.yml b/.github/actions/doc_preview/action.yml index 0c60b899fbf..6e04abd3f1f 100644 --- a/.github/actions/doc_preview/action.yml +++ b/.github/actions/doc_preview/action.yml @@ -29,6 +29,11 @@ runs: folder: ${{ inputs.source-folder }} target-folder: docs/pr-preview/pr-${{ inputs.pr-number }}/ commit-message: "Deploy doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})" + # Every PR preview, the main docs deploy, and the coverage deploy commit to + # the shared gh-pages branch. Rebase onto a deployment that landed in the + # meantime instead of force-pushing over it, which the branch ruleset + # rejects (and which used to discard the other deployment). + force: false - name: Leave a comment after deployment if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} @@ -56,6 +61,7 @@ runs: folder: ${{ inputs.source-folder }} target-folder: docs/pr-preview/pr-${{ inputs.pr-number }}/ commit-message: "Clean up doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})" + force: false - name: Leave a comment after removal if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }} diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index bef2a7e84c0..8dcb9608186 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -357,3 +357,6 @@ jobs: target-folder: docs/ commit-message: "Deploy ${{ (inputs.is-release && 'release') || 'latest' }} docs: ${{ env.CUDA_PYTHON_DOCS_GITHUB_REF }}" clean: false + # Rebase onto concurrent PR-preview or coverage deployments instead of + # force-pushing, which the gh-pages ruleset rejects. + force: false diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 6015db55c9d..b336e622940 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -575,3 +575,6 @@ jobs: target-folder: docs/ commit-message: "Deploy combined coverage (Linux + Windows): ${{ github.sha }}" clean: false + # Rebase onto concurrent docs deployments instead of force-pushing, + # which the gh-pages ruleset rejects. + force: false