From 604f2994711f4cc745f676327fac6d22dfe1f6f5 Mon Sep 17 00:00:00 2001 From: Yihao Gao Date: Tue, 18 Aug 2026 11:53:35 +1000 Subject: [PATCH] build: alpha-publish skip commenting if there is no PR associated with the branch instead of failing --- .github/workflows/alpha-publish.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/alpha-publish.yml b/.github/workflows/alpha-publish.yml index 82c5ddf..197a6d6 100644 --- a/.github/workflows/alpha-publish.yml +++ b/.github/workflows/alpha-publish.yml @@ -54,7 +54,7 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create PR Comment - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: script: | const packageName = require('./package.json').name; @@ -66,7 +66,12 @@ jobs: state: 'open', head: `${context.repo.owner}:${context.ref.replace('refs/heads/', '')}` }) - const pr = context.issue.number || issues.data[0].number + const pr = context.issue.number || issues.data[0]?.number + + if (!pr) { + core.info(`No open PR for branch ${context.ref.replace('refs/heads/', '')}; skipping PR comment.`) + return + } github.rest.issues.createComment({ owner: context.repo.owner,