From c150ab8da89167e180e154a6039a2c6a868df7d4 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Fri, 25 Sep 2026 17:31:08 +0200 Subject: [PATCH] Make docs manual-dispatch deploy branch explicit A workflow_dispatch of docs.yml on main is an intentional production rebuild. Rename the non-release deploy step accordingly and pass --branch=${{ github.ref_name }} so the Pages branch (production vs preview) is explicit rather than inferred from git by wrangler. Skip the PR lookup/comment on main: there the deploy is production and the associated PR is the already-merged one, which previously got a misleading "Preview deployed" comment (e.g. #49). Fixes #113 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docs.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d04c471b..af98976a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -43,22 +43,25 @@ jobs: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} command: pages deploy docs/target/site/ --project-name=lz4-java-yawk-at --branch=main - - name: Publish preview + # Dispatch on main is a production rebuild; any other branch gives a preview deployment. + # wrangler-action runs the command without a shell, so the ref can't be passed via env var. + - name: Publish (manual dispatch) if: github.event_name != 'release' uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4 - id: cf_publish_preview + id: cf_publish_dispatch with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy docs/target/site/ --project-name=lz4-java-yawk-at + command: pages deploy docs/target/site/ --project-name=lz4-java-yawk-at --branch=${{ github.ref_name }} + # Not on main: that deploy is production, and the only associated PR is an already-merged one. - name: Check PR - if: github.event_name != 'release' + if: github.event_name != 'release' && github.ref != 'refs/heads/main' uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0 id: pr - name: Comment on PR if: steps.pr.outputs.pr_found uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3 with: - message: ":rocket: Preview deployed to ${{steps.cf_publish_preview.outputs.deployment-url}}" + message: ":rocket: Preview deployed to ${{steps.cf_publish_dispatch.outputs.deployment-url}}" comment-tag: deployment pr-number: "${{steps.pr.outputs.number}}"