From cb1f3e75373ab6aa68d8cab391c4784a40892dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Mon, 13 Jul 2026 10:30:06 +0200 Subject: [PATCH] fix(ci): fix mirror SHA detection in e2e-label-help workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The branches API endpoint cannot handle ref names with slashes (e.g. pull-request/2223). When the API returns a 404, gh api writes the error JSON to stdout before exiting non-zero, so the || fallback never fires. This causes mirror_sha to contain raw JSON like {"message":"Branch not found",...} and the comment displays `{"messa` as the SHA. Switch to the git/ref/heads/ endpoint which handles slashes natively, and add a regex guard to reset mirror_sha to empty when it does not look like a valid 40-char hex SHA. Signed-off-by: Roland Huß --- .github/workflows/e2e-label-help.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-label-help.yml b/.github/workflows/e2e-label-help.yml index 1190bcd3d3..4c3a1dfe6f 100644 --- a/.github/workflows/e2e-label-help.yml +++ b/.github/workflows/e2e-label-help.yml @@ -59,7 +59,8 @@ jobs: esac mirror_ref="pull-request/$PR_NUMBER" - mirror_sha=$(gh api "repos/$GH_REPO/branches/$mirror_ref" --jq '.commit.sha' 2>/dev/null || echo "") + mirror_sha=$(gh api "repos/$GH_REPO/git/ref/heads/$mirror_ref" --jq '.object.sha' 2>/dev/null || true) + if [[ ! "$mirror_sha" =~ ^[0-9a-f]{40}$ ]]; then mirror_sha=""; fi short_pr=${PR_HEAD_SHA:0:7} if [ -z "$mirror_sha" ]; then