From 7a4abd74ca7d1a26ff2a8591b2c6c7d72b89d268 Mon Sep 17 00:00:00 2001 From: Diletta Cal Date: Sat, 31 Oct 2026 15:39:42 +0100 Subject: [PATCH] fix: check out release scripts at caller-pinned ref Under workflow_call, github.workflow_sha is the caller's commit, so the .shared-workflows checkout failed with "not our ref" in consumer repos. Add an optional workflows-ref input (falls back for self-dispatch) and grant pull-requests: write in the release caller example. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/publish-release.yml | 7 ++++++- CHANGELOG.md | 5 +++++ README.md | 3 +++ examples/publish-release.yml | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 6cf5bce..07b40e3 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -13,6 +13,10 @@ on: description: Stable X.Y.Z release version without v. required: true type: string + workflows-ref: + description: The github-workflows SHA this caller pins in `uses:`. Callers must set it. + required: false + type: string outputs: release-url: description: URL of the created or existing GitHub Release. @@ -45,7 +49,8 @@ jobs: uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 with: repository: dilettacal/github-workflows - ref: ${{ github.workflow_sha }} + # github.workflow_sha is the caller's commit inside workflow_call. + ref: ${{ inputs.workflows-ref || github.workflow_sha }} path: .shared-workflows - name: Capture release date id: date diff --git a/CHANGELOG.md b/CHANGELOG.md index fb19318..8ffba2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to these reusable GitHub Actions workflows are recorded here ## [Unreleased] +### Fixed + +- Check out release scripts at the caller-pinned `workflows-ref`; `github.workflow_sha` is the caller's commit under `workflow_call`. +- Grant `pull-requests: write` in the release caller example. + ## [0.1.0] - 2026-10-31 ### Added diff --git a/README.md b/README.md index cf88710..3b5e077 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ Shared GitHub Actions policy and release workflows, maintained once and pinned b Copy a caller from [`examples/`](examples/), pin ``, and keep the caller responsible for events, permissions, checks, and branch protection. +Release callers pass the same SHA as `workflows-ref`: inside `workflow_call`, +`github.workflow_sha` is the caller's commit, not this repository's. + Release callers dispatch `X.Y.Z`: first run opens a release PR; after merging it, run the same version again to publish the tag and GitHub Release. diff --git a/examples/publish-release.yml b/examples/publish-release.yml index 7844e47..c3624db 100644 --- a/examples/publish-release.yml +++ b/examples/publish-release.yml @@ -10,9 +10,11 @@ on: permissions: contents: write + pull-requests: write jobs: release: uses: dilettacal/github-workflows/.github/workflows/publish-release.yml@ with: release-version: ${{ inputs.release-version }} + workflows-ref: