From 6abec8f9922d04b8fe1d5b858b7e342d577eb112 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Sat, 18 Apr 2026 09:41:52 +0200 Subject: [PATCH 1/2] ci: Fix docs release failing on detached HEAD When manual_release_docs.yaml is invoked with a commit SHA as ref (e.g. from doc_release_post_publish in on_master.yaml or from the stable release pipeline), actions/checkout leaves the repo in a detached HEAD state and the hand-rolled git push fails with "fatal: You are not currently on a branch." Switch to EndBug/add-and-commit with new_branch set to the default branch, and apply the same fix to manual_version_docs.yaml where the same latent bug existed. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/manual_release_docs.yaml | 14 +++++++------- .github/workflows/manual_version_docs.yaml | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/manual_release_docs.yaml b/.github/workflows/manual_release_docs.yaml index 07f68f63..afdef1b0 100644 --- a/.github/workflows/manual_release_docs.yaml +++ b/.github/workflows/manual_release_docs.yaml @@ -74,13 +74,13 @@ jobs: run: uv run poe update-docs-theme - name: Commit the updated package.json and lockfile - run: | - git config user.name 'GitHub Actions' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git add website/package.json - git add website/yarn.lock - git diff-index --quiet HEAD || git commit -m 'chore: Automatic docs theme update [skip ci]' || true - git push + uses: EndBug/add-and-commit@v10 + with: + add: website/package.json website/yarn.lock + message: "chore: Automatic docs theme update [skip ci]" + default_author: github_actions + # Required: checkout may leave a detached HEAD when invoked with a SHA ref. + new_branch: ${{ github.event.repository.default_branch }} - name: Build docs run: uv run poe build-docs diff --git a/.github/workflows/manual_version_docs.yaml b/.github/workflows/manual_version_docs.yaml index b9f99886..c8946fa4 100644 --- a/.github/workflows/manual_version_docs.yaml +++ b/.github/workflows/manual_version_docs.yaml @@ -123,6 +123,8 @@ jobs: add: website/versioned_docs website/versioned_sidebars website/versions.json message: "docs: Version docs for v${{ steps.snapshot.outputs.version }} [skip ci]" default_author: github_actions + # Required: checkout may leave a detached HEAD when invoked with a SHA ref. + new_branch: ${{ github.event.repository.default_branch }} - name: Resolve output commitish id: resolve_commitish From c83c731d20140cec85300c0fc401b8d99d429602 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Mon, 20 Apr 2026 12:19:17 +0200 Subject: [PATCH 2/2] Final polishment --- .github/workflows/manual_release_docs.yaml | 21 +++--------------- .github/workflows/manual_release_stable.yaml | 5 +++-- .github/workflows/manual_version_docs.yaml | 23 ++++---------------- 3 files changed, 10 insertions(+), 39 deletions(-) diff --git a/.github/workflows/manual_release_docs.yaml b/.github/workflows/manual_release_docs.yaml index afdef1b0..bbb441b2 100644 --- a/.github/workflows/manual_release_docs.yaml +++ b/.github/workflows/manual_release_docs.yaml @@ -3,18 +3,12 @@ name: Release docs on: # Runs when manually triggered from the GitHub UI. workflow_dispatch: - inputs: - ref: - description: Git ref to checkout (branch, tag, or SHA). Defaults to the default branch. - required: false - type: string - default: "" # Runs when invoked by another workflow. workflow_call: inputs: ref: - description: Git ref to checkout (branch, tag, or SHA) + description: Git ref to checkout. required: true type: string @@ -37,20 +31,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Determine checkout ref - id: resolve_ref - env: - INPUT_REF: ${{ inputs.ref }} - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - run: | - REF="${INPUT_REF:-$DEFAULT_BRANCH}" - echo "ref=$REF" >> "$GITHUB_OUTPUT" - - name: Checkout repository uses: actions/checkout@v6 with: token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - ref: ${{ steps.resolve_ref.outputs.ref }} + ref: ${{ inputs.ref || github.event.repository.default_branch }} - name: Set up Node uses: actions/setup-node@v6 @@ -79,7 +64,7 @@ jobs: add: website/package.json website/yarn.lock message: "chore: Automatic docs theme update [skip ci]" default_author: github_actions - # Required: checkout may leave a detached HEAD when invoked with a SHA ref. + # `actions/checkout` detaches HEAD on SHA refs; EndBug needs a branch to push. new_branch: ${{ github.event.repository.default_branch }} - name: Build docs diff --git a/.github/workflows/manual_release_stable.yaml b/.github/workflows/manual_release_stable.yaml index fd92399d..6283659f 100644 --- a/.github/workflows/manual_release_stable.yaml +++ b/.github/workflows/manual_release_stable.yaml @@ -98,7 +98,7 @@ jobs: version_number: ${{ needs.release_prepare.outputs.version_number }} ref: ${{ needs.changelog_update.outputs.changelog_commitish }} - # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. + # Publish the package to PyPI using PyPA official GitHub action with OIDC authentication. - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -109,6 +109,7 @@ jobs: contents: write uses: ./.github/workflows/manual_version_docs.yaml with: + # Commit the version docs changes on top of the changelog commit. ref: ${{ needs.changelog_update.outputs.changelog_commitish }} secrets: inherit @@ -121,7 +122,7 @@ jobs: id-token: write uses: ./.github/workflows/manual_release_docs.yaml with: - # Use the version_docs commit to include both changelog and versioned docs. + # Commit the docs release changes on top of the version docs commit. ref: ${{ needs.version_docs.outputs.version_docs_commitish }} secrets: inherit diff --git a/.github/workflows/manual_version_docs.yaml b/.github/workflows/manual_version_docs.yaml index c8946fa4..d2fe9d88 100644 --- a/.github/workflows/manual_version_docs.yaml +++ b/.github/workflows/manual_version_docs.yaml @@ -3,23 +3,17 @@ name: Version docs on: # Runs when manually triggered from the GitHub UI. workflow_dispatch: - inputs: - ref: - description: Git ref to checkout (branch, tag, or SHA). Defaults to the default branch. - required: false - type: string - default: "" # Runs when invoked by another workflow. workflow_call: inputs: ref: - description: Git ref to checkout (branch, tag, or SHA) + description: Git ref to checkout. required: true type: string outputs: version_docs_commitish: - description: The commit SHA of the versioned docs commit + description: The commit SHA of the versioned docs commit. value: ${{ jobs.version_docs.outputs.version_docs_commitish }} concurrency: @@ -43,20 +37,11 @@ jobs: contents: write steps: - - name: Determine checkout ref - id: resolve_ref - env: - INPUT_REF: ${{ inputs.ref }} - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - run: | - REF="${INPUT_REF:-$DEFAULT_BRANCH}" - echo "ref=$REF" >> "$GITHUB_OUTPUT" - - name: Checkout repository uses: actions/checkout@v6 with: token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - ref: ${{ steps.resolve_ref.outputs.ref }} + ref: ${{ inputs.ref || github.event.repository.default_branch }} - name: Set up Node uses: actions/setup-node@v6 @@ -123,7 +108,7 @@ jobs: add: website/versioned_docs website/versioned_sidebars website/versions.json message: "docs: Version docs for v${{ steps.snapshot.outputs.version }} [skip ci]" default_author: github_actions - # Required: checkout may leave a detached HEAD when invoked with a SHA ref. + # `actions/checkout` detaches HEAD on SHA refs; EndBug needs a branch to push. new_branch: ${{ github.event.repository.default_branch }} - name: Resolve output commitish