From 3e696c3e65d95c66c30b74bd7c741002f0fcd305 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Tue, 23 Jun 2026 12:40:32 +0800 Subject: [PATCH] Fix IBIT zscore workflow and Dependabot guard --- .github/workflows/dependabot_auto_merge.yml | 11 +++++++++-- .github/workflows/publish-strategy-plugins.yml | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot_auto_merge.yml b/.github/workflows/dependabot_auto_merge.yml index 585c4b8..476c38d 100644 --- a/.github/workflows/dependabot_auto_merge.yml +++ b/.github/workflows/dependabot_auto_merge.yml @@ -22,12 +22,19 @@ jobs: run: | set -euo pipefail BRANCH_NAME="${{ github.event.workflow_run.head_branch }}" - PR_NUMBER=$(gh pr list --repo "${GITHUB_REPOSITORY}" --state open --head "${BRANCH_NAME}" --json number --jq '.[0].number // empty') + PR_PAYLOAD=$(gh pr list --repo "${GITHUB_REPOSITORY}" --state open --head "${BRANCH_NAME}" --json number,headRefOid --jq '.[0] // {}') + PR_NUMBER=$(python3 -c 'import json,sys; print(json.load(sys.stdin).get("number", ""))' <<<"${PR_PAYLOAD}") + PR_HEAD_SHA=$(python3 -c 'import json,sys; print(json.load(sys.stdin).get("headRefOid", ""))' <<<"${PR_PAYLOAD}") if [ -z "${PR_NUMBER}" ]; then echo "No open Dependabot PR found for ${BRANCH_NAME}." >> "$GITHUB_STEP_SUMMARY" exit 0 fi + if [ "${PR_HEAD_SHA}" != "${{ github.event.workflow_run.head_sha }}" ]; then + echo "Skipping auto-merge: PR #${PR_NUMBER} head ${PR_HEAD_SHA} does not match completed CI head ${{ github.event.workflow_run.head_sha }}." >> "$GITHUB_STEP_SUMMARY" + exit 0 + fi echo "pr_number=${PR_NUMBER}" >> "$GITHUB_OUTPUT" + echo "head_sha=${PR_HEAD_SHA}" >> "$GITHUB_OUTPUT" - name: Evaluate merge eligibility id: merge_guard @@ -81,4 +88,4 @@ jobs: if: steps.merge_guard.outputs.should_merge == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh pr merge "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --rebase --delete-branch + run: gh pr merge "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --rebase --delete-branch --match-head-commit "${{ steps.pr.outputs.head_sha }}" diff --git a/.github/workflows/publish-strategy-plugins.yml b/.github/workflows/publish-strategy-plugins.yml index 22a2a34..b244800 100644 --- a/.github/workflows/publish-strategy-plugins.yml +++ b/.github/workflows/publish-strategy-plugins.yml @@ -632,6 +632,7 @@ jobs: printf '%s\n' "${metrics_urls}" echo "EOF" } >> "$GITHUB_ENV" + export ZSCORE_METRICS_URLS="${metrics_urls}" echo "Resolved ${STRATEGY_PROFILE} ${PLUGIN_NAME} publish prefix: ${gcs_prefix}" python - <<'PY' import os