From 90b57b9d1d95d2c1ec41985ed5b63f1489b6b48b Mon Sep 17 00:00:00 2001 From: Tobias Schmidt <13055656+schmidtnz@users.noreply.github.com> Date: Thu, 13 Aug 2026 15:13:51 +1200 Subject: [PATCH 1/2] chore: demo workflow for github.sha vs pull request head sha BM-1850 --- .github/workflows/sha-demo.yml | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/sha-demo.yml diff --git a/.github/workflows/sha-demo.yml b/.github/workflows/sha-demo.yml new file mode 100644 index 00000000..87432e59 --- /dev/null +++ b/.github/workflows/sha-demo.yml @@ -0,0 +1,61 @@ +name: sha-demo + +# Demo only, not for merging. BM-1850 background: on a pull_request event `github.sha` is +# the ephemeral merge commit, not the branch tip. Runs on both events so a push run and a +# pull request run of the same file can be compared line for line. +on: + pull_request: + push: + +jobs: + # Which sha is which, and what checkout actually hands you. + values: + runs-on: ubuntu-latest + steps: + - name: Echo the shas + env: + EVENT: ${{ github.event_name }} + GH_SHA: ${{ github.sha }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + HEAD_REF: ${{ github.head_ref }} + REF_NAME: ${{ github.ref_name }} + FALLBACK: ${{ github.event.pull_request.head.sha || github.sha }} + run: | + # Square brackets so an empty value is visible instead of looking like a blank line. + printf '%-26s [%s]\n' \ + 'github.event_name' "$EVENT" \ + 'github.sha' "$GH_SHA" \ + 'pull_request.head.sha' "$PR_HEAD_SHA" \ + 'github.head_ref' "$HEAD_REF" \ + 'github.ref_name' "$REF_NAME" \ + 'head.sha || github.sha' "$FALLBACK" + + - uses: actions/checkout@v6 + + - name: What checkout actually gave us + run: | + # On a pull request this is the merge commit: two parents, "Merge
into