From f62ef9e064d357e3a06df694f23e57feb47b266c Mon Sep 17 00:00:00 2001 From: "Ian.Leggett" Date: Thu, 27 Aug 2026 14:57:06 +0000 Subject: [PATCH 01/13] fix: skip pre-commit hooks when merging a branch to a PR Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 42 ++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index 4dfde1e7..904fe5bc 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -16,6 +16,7 @@ jobs: env: SIGNED_OFF_MESSAGE: "Signed-off-by: DBT pre-commit check" FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" + GH_TOKEN: ${{ github.token }} runs-on: ubuntu-latest permissions: @@ -30,18 +31,35 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - # If this commit belongs to a github PR, it will not have the git trailer that is set by - # the pre-commit hook. If the response is NOT an empty array, that means the commit was from - # a PR and we can skip the git trailer checks - - is_pr_commit=$(gh pr list --search ${{ github.event.pull_request.head.sha }} --state merged --json id | jq '. != []') - - if [ "$is_pr_commit" == true ]; then - echo "This commit came from a PR, it will not have the trailer from a pre-commit hook" - exit 0 - fi - echo "We need to check this for the trailers" - git log ${{ github.event.pull_request.head.sha }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' + + DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name') + SHA=$(gh pr view --json headRefOid --jq .headRefOid) + + IS_MERGE_COMMIT=false + IS_DEFAULT_BRANCH_COMMIT=false + + PARENTS=$(git show --no-patch --format=%P "$SHA") + PARENT_COUNT=$(wc -w <<< "$PARENTS") + + # Check for merge commit + if [[ $PARENT_COUNT -gt 1 ]]; then + IS_MERGE_COMMIT=true + + # Check whether one parent comes from the default branch + for parent in $PARENTS; do + if git merge-base --is-ancestor "$parent" "origin/$DEFAULT_BRANCH"; then + IS_DEFAULT_BRANCH_COMMIT=true + break + fi + done + fi + + if [[ "$IS_MERGE_COMMIT" == "true" || "$IS_DEFAULT_BRANCH_COMMIT" == "true" ]]; then + echo "This commit came from a PR, it will not have the trailer from a pre-commit hook" + exit 0 + fi + echo "We need to check this for the trailers" + git log ${{ github.event.pull_request.head.sha }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' - name: Find failure comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad From 6cb63ece1edd8e4cb28ad7ef7e642c94f0e1ab33 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:10:07 +0000 Subject: [PATCH 02/13] feat: Derive default branch from GHA env var Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index 904fe5bc..2d45990e 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -17,6 +17,7 @@ jobs: SIGNED_OFF_MESSAGE: "Signed-off-by: DBT pre-commit check" FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" GH_TOKEN: ${{ github.token }} + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} runs-on: ubuntu-latest permissions: @@ -31,8 +32,6 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - - DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name') SHA=$(gh pr view --json headRefOid --jq .headRefOid) IS_MERGE_COMMIT=false @@ -47,7 +46,7 @@ jobs: # Check whether one parent comes from the default branch for parent in $PARENTS; do - if git merge-base --is-ancestor "$parent" "origin/$DEFAULT_BRANCH"; then + if git merge-base --is-ancestor "$parent" "origin/${{ env.DEFAULT_BRANCH }}"; then IS_DEFAULT_BRANCH_COMMIT=true break fi From b3fbb2c021f91d3b396ca591e2274870d00a3f93 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:13:17 +0000 Subject: [PATCH 03/13] feat: Derive HEAD SHA from GHA Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index 2d45990e..c4a1ff6a 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -32,7 +32,7 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - SHA=$(gh pr view --json headRefOid --jq .headRefOid) + SHA=${{ github.event.pull_request.head.sha }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false From 8ec1777bcbe107778215f9f78f02229e713a89e6 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:15:13 +0000 Subject: [PATCH 04/13] feat: Derive HEAD SHA from GHA (2) Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index c4a1ff6a..f4bda539 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -18,6 +18,7 @@ jobs: FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" GH_TOKEN: ${{ github.token }} DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} runs-on: ubuntu-latest permissions: @@ -32,7 +33,7 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - SHA=${{ github.event.pull_request.head.sha }} + SHA=${{ env.PR_HEAD_SHA }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false @@ -58,7 +59,7 @@ jobs: exit 0 fi echo "We need to check this for the trailers" - git log ${{ github.event.pull_request.head.sha }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' + git log ${{ env.PR_HEAD_SHA }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' - name: Find failure comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad From 132e29281de0749ec5785462c28849242213e851 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:19:56 +0000 Subject: [PATCH 05/13] feat: Derive HEAD SHA from GHA (3) Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index f4bda539..c4a1ff6a 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -18,7 +18,6 @@ jobs: FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" GH_TOKEN: ${{ github.token }} DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} runs-on: ubuntu-latest permissions: @@ -33,7 +32,7 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - SHA=${{ env.PR_HEAD_SHA }} + SHA=${{ github.event.pull_request.head.sha }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false @@ -59,7 +58,7 @@ jobs: exit 0 fi echo "We need to check this for the trailers" - git log ${{ env.PR_HEAD_SHA }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' + git log ${{ github.event.pull_request.head.sha }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' - name: Find failure comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad From abdf924b3c7d4d616acaa598c936f54e846b06c5 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:21:06 +0000 Subject: [PATCH 06/13] feat: Derive HEAD SHA from GHA (4) Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index c4a1ff6a..2d45990e 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -32,7 +32,7 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - SHA=${{ github.event.pull_request.head.sha }} + SHA=$(gh pr view --json headRefOid --jq .headRefOid) IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false From 41c2a1bd7221c7fa67664d3dbbc881b6b162d4d1 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:26:44 +0000 Subject: [PATCH 07/13] feat: Attach to branch before running other git commands Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index 2d45990e..e855b1e1 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -33,11 +33,12 @@ jobs: id: pre-commit-check run: | SHA=$(gh pr view --json headRefOid --jq .headRefOid) + git checkout ${{ github.head_ref }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false - PARENTS=$(git show --no-patch --format=%P "$SHA") + PARENTS=$(git show --no-patch --format=%P "${{ github.event.pull_request.head.sha }}") PARENT_COUNT=$(wc -w <<< "$PARENTS") # Check for merge commit From 08fd70db8988c356c4995c9a683bf8738bf73e10 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:30:42 +0000 Subject: [PATCH 08/13] feat: Attach to branch before running other git commands Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index e855b1e1..0078bcad 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -18,6 +18,8 @@ jobs: FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" GH_TOKEN: ${{ github.token }} DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + CURRENT_BRANCH: ${{ github.head_ref }} + HEAD_REF: ${{ github.event.pull_request.head.sha }} runs-on: ubuntu-latest permissions: @@ -32,13 +34,12 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - SHA=$(gh pr view --json headRefOid --jq .headRefOid) - git checkout ${{ github.head_ref }} + git checkout ${{ env.CURRENT_BRANCH }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false - PARENTS=$(git show --no-patch --format=%P "${{ github.event.pull_request.head.sha }}") + PARENTS=$(git show --no-patch --format=%P "${{ env.HEAD_REF }}") PARENT_COUNT=$(wc -w <<< "$PARENTS") # Check for merge commit @@ -59,7 +60,7 @@ jobs: exit 0 fi echo "We need to check this for the trailers" - git log ${{ github.event.pull_request.head.sha }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' + git log ${{ env.HEAD_REF }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' - name: Find failure comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad From 0646a8969cbb0802fcae440be1dbd90316cd6488 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:33:29 +0000 Subject: [PATCH 09/13] fix: var formatting Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index 0078bcad..7d382ff8 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -34,12 +34,12 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - git checkout ${{ env.CURRENT_BRANCH }} + git checkout '${{ env.CURRENT_BRANCH }}' IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false - PARENTS=$(git show --no-patch --format=%P "${{ env.HEAD_REF }}") + PARENTS=$(git show --no-patch --format=%P "'${{ env.HEAD_REF }}'") PARENT_COUNT=$(wc -w <<< "$PARENTS") # Check for merge commit @@ -48,7 +48,7 @@ jobs: # Check whether one parent comes from the default branch for parent in $PARENTS; do - if git merge-base --is-ancestor "$parent" "origin/${{ env.DEFAULT_BRANCH }}"; then + if git merge-base --is-ancestor "$parent" "origin/'${{ env.DEFAULT_BRANCH }}'"; then IS_DEFAULT_BRANCH_COMMIT=true break fi @@ -60,7 +60,7 @@ jobs: exit 0 fi echo "We need to check this for the trailers" - git log ${{ env.HEAD_REF }} --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' + git log '${{ env.HEAD_REF }}' --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' - name: Find failure comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad From d59eaab833e451f5a718e13e1099b02071f263b2 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:35:40 +0000 Subject: [PATCH 10/13] fix: var formatting (2() Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index 7d382ff8..d4f2ead1 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -16,10 +16,10 @@ jobs: env: SIGNED_OFF_MESSAGE: "Signed-off-by: DBT pre-commit check" FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" - GH_TOKEN: ${{ github.token }} - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - CURRENT_BRANCH: ${{ github.head_ref }} - HEAD_REF: ${{ github.event.pull_request.head.sha }} + GH_TOKEN: '${{ github.token }}' + DEFAULT_BRANCH: '${{ github.event.repository.default_branch }}' + CURRENT_BRANCH: '${{ github.head_ref }}' + HEAD_REF: '${{ github.event.pull_request.head.sha }}' runs-on: ubuntu-latest permissions: @@ -33,6 +33,8 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check + env: + CURRENT_BRANCH: run: | git checkout '${{ env.CURRENT_BRANCH }}' From f6da33f5195b92077c4df0ca5dbc48550ec9b760 Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:41:02 +0000 Subject: [PATCH 11/13] fix: var formatting (3) Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index d4f2ead1..6d4ccca7 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -16,10 +16,10 @@ jobs: env: SIGNED_OFF_MESSAGE: "Signed-off-by: DBT pre-commit check" FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" - GH_TOKEN: '${{ github.token }}' - DEFAULT_BRANCH: '${{ github.event.repository.default_branch }}' - CURRENT_BRANCH: '${{ github.head_ref }}' - HEAD_REF: '${{ github.event.pull_request.head.sha }}' + GH_TOKEN: ${{ github.token }} + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + CURRENT_BRANCH: ${{ github.head_ref }} + HEAD_REF: ${{ github.event.pull_request.head.sha }} runs-on: ubuntu-latest permissions: @@ -33,15 +33,13 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check - env: - CURRENT_BRANCH: run: | - git checkout '${{ env.CURRENT_BRANCH }}' + git checkout ${{ env.CURRENT_BRANCH }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false - PARENTS=$(git show --no-patch --format=%P "'${{ env.HEAD_REF }}'") + PARENTS=$(git show --no-patch --format=%P "${{ env.HEAD_REF }}") PARENT_COUNT=$(wc -w <<< "$PARENTS") # Check for merge commit @@ -50,7 +48,7 @@ jobs: # Check whether one parent comes from the default branch for parent in $PARENTS; do - if git merge-base --is-ancestor "$parent" "origin/'${{ env.DEFAULT_BRANCH }}'"; then + if git merge-base --is-ancestor "$parent" "origin/${{ env.DEFAULT_BRANCH }}"; then IS_DEFAULT_BRANCH_COMMIT=true break fi @@ -62,7 +60,7 @@ jobs: exit 0 fi echo "We need to check this for the trailers" - git log '${{ env.HEAD_REF }}' --format=%B -1 | git interpret-trailers --parse | grep '${{ env.SIGNED_OFF_MESSAGE }}' + git log ${{ env.HEAD_REF }} --format=%B -1 | git interpret-trailers --parse | grep ${{ env.SIGNED_OFF_MESSAGE }} - name: Find failure comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad From 6388295eeb954879c39fb18678c90147361a9bce Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:42:50 +0000 Subject: [PATCH 12/13] fix: var formatting (4) Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index 6d4ccca7..c0abe561 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -17,9 +17,6 @@ jobs: SIGNED_OFF_MESSAGE: "Signed-off-by: DBT pre-commit check" FAILURE_MESSAGE: "Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run `pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit`, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage" GH_TOKEN: ${{ github.token }} - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - CURRENT_BRANCH: ${{ github.head_ref }} - HEAD_REF: ${{ github.event.pull_request.head.sha }} runs-on: ubuntu-latest permissions: @@ -34,12 +31,12 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - git checkout ${{ env.CURRENT_BRANCH }} + git checkout ${{ github.head_ref }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false - PARENTS=$(git show --no-patch --format=%P "${{ env.HEAD_REF }}") + PARENTS=$(git show --no-patch --format=%P "${{ github.event.pull_request.head.sha }}") PARENT_COUNT=$(wc -w <<< "$PARENTS") # Check for merge commit @@ -48,7 +45,7 @@ jobs: # Check whether one parent comes from the default branch for parent in $PARENTS; do - if git merge-base --is-ancestor "$parent" "origin/${{ env.DEFAULT_BRANCH }}"; then + if git merge-base --is-ancestor "$parent" "origin/${{ github.event.repository.default_branch }}"; then IS_DEFAULT_BRANCH_COMMIT=true break fi @@ -60,7 +57,7 @@ jobs: exit 0 fi echo "We need to check this for the trailers" - git log ${{ env.HEAD_REF }} --format=%B -1 | git interpret-trailers --parse | grep ${{ env.SIGNED_OFF_MESSAGE }} + git log ${{ github.event.pull_request.head.sha }} --format=%B -1 | git interpret-trailers --parse | grep ${{ env.SIGNED_OFF_MESSAGE }} - name: Find failure comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad From 267e1cfac3d81e3be2cad550218a4a00459820aa Mon Sep 17 00:00:00 2001 From: SamW94 Date: Thu, 27 Aug 2026 16:46:24 +0000 Subject: [PATCH 13/13] fix: var formatting (5) Signed-off-by: DBT pre-commit check --- .github/workflows/org.common-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/org.common-ci.yml b/.github/workflows/org.common-ci.yml index c0abe561..0af5e0dc 100644 --- a/.github/workflows/org.common-ci.yml +++ b/.github/workflows/org.common-ci.yml @@ -31,7 +31,7 @@ jobs: - name: Check if pre-commit hook ran before push id: pre-commit-check run: | - git checkout ${{ github.head_ref }} + git checkout ${{ github.event.pull_request.head.ref }} IS_MERGE_COMMIT=false IS_DEFAULT_BRANCH_COMMIT=false