From 6838b6bff9ab5c400432caefd8c8737b86c41f07 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Tue, 4 Aug 2026 01:44:28 +0800 Subject: [PATCH] fix(ci): guard release PR branch parsing --- .github/workflows/release.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 704d6a281..b733d3372 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,8 +54,20 @@ jobs: shell: bash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_PR_BRANCH: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} + RELEASE_PR_JSON: ${{ steps.release.outputs.pr }} run: | + release_pr_branch="$(node --input-type=module -e ' + const value = JSON.parse(process.env.RELEASE_PR_JSON ?? ""); + if ( + typeof value !== "object" || + value === null || + typeof value.headBranchName !== "string" || + value.headBranchName.length === 0 + ) { + process.exit(1); + } + process.stdout.write(value.headBranchName); + ')" changed_paths="$(git diff --name-only)" if [[ -z "${changed_paths}" ]]; then echo "Release documentation is already canonical." @@ -72,7 +84,7 @@ jobs: git add -- docs/product-catalog.json git commit -m "chore: normalize release product catalog" gh auth setup-git - git push origin "HEAD:${RELEASE_PR_BRANCH}" + git push origin "HEAD:${release_pr_branch}" publish: name: Publish to npm