@@ -143,37 +143,11 @@ jobs:
143143 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
144144 EXPECTED_SHA : ${{ github.event.pull_request.head.sha }}
145145 run : |
146- declare -r gh_pr_number='${{ github.event.pull_request.number }}'
147- declare -r gh_repository='${{ github.repository }}'
148- declare -r gh_current_run_id='${{ github.run_id }}'
149-
150- # 1. Fetch current PR HEAD SHA to ensure no new commit was pushed while this ran
151- CURRENT_SHA=$(gh pr view "${gh_pr_number}" \
152- --repo "${gh_repository}" \
153- --json headRefOid --jq '.headRefOid')
154-
155- if [ "${CURRENT_SHA}" != "${EXPECTED_SHA}" ]; then
156- echo "A new commit (${CURRENT_SHA}) was pushed after this run started (${EXPECTED_SHA}). Aborting auto-merge."
157- exit 1
158- fi
159-
160- # 2. Allowlist filter: select any check whose state is NOT in [SUCCESS, SKIPPED, NEUTRAL],
161- # filtering out the current workflow run by checking if its link contains gh_current_run_id.
162- NON_PASSING_CHECKS=$(gh pr checks "${gh_pr_number}" \
163- --repo "${gh_repository}" \
164- --json workflow,name,state,link |
165- jq --compact --arg current_run_id "${gh_current_run_id}" \
166- '.[] | select(
167- (.link | contains($current_run_id) | not)
168- and
169- (.state | test("^(SUCCESS|SKIPPED|NEUTRAL)$") | not)
170- )')
171-
172- if [ -n "${NON_PASSING_CHECKS}" ]; then
173- echo "Cannot auto-merge. The following checks are not passing:"
174- echo "${NON_PASSING_CHECKS}" | jq -r '"workflow: \(.workflow), name: \(.name), state: \(.state)""'
175- exit 1
176- fi
146+ ${{ github.workspace }}/.github/scripts/verify-all-pr-workflow-checks-passed.sh \
147+ '${{ github.event.pull_request.head.sha }}' \
148+ '${{ github.event.pull_request.number }}' \
149+ '${{ github.repository }}' \
150+ '${{ github.run_id }}'
177151
178152 - name : Enable auto-merge via squash
179153 env :
0 commit comments