From 9c2c72c78ec73e1c0efdfcd19388ef51052c3a4d Mon Sep 17 00:00:00 2001 From: herokwon Date: Wed, 1 Jan 2025 14:16:13 +0900 Subject: [PATCH] =?UTF-8?q?Chore:=20Github=20Actions=20`Release`=20workflo?= =?UTF-8?q?w=20=EB=82=B4=20Pull=20request=20`head=5Fref`=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EC=9E=91=EC=97=85=20=EC=B6=94=EA=B0=80=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 41 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5111453..80fafb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,9 +51,29 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Check a latest pull request + id: pr + uses: actions/github-script@v7 + with: + script: | + const result = (await github.rest.repos.listPullRequestsAssociatedWithCommit({ + commit_sha: context.sha, + owner: context.repo.owner, + repo: context.repo.repo, + })).data[0]; + + return { + head_ref: result.head.ref, + commit: result.merge_commit_sha.substring(0, 7), + number: result.number, + title: result.title, + url: result.html_url, + avatar_url: context.payload.repository.owner.avatar_url + }; + - name: Publish on npm id: changesets - if: startsWith(github.head_ref, 'changeset-release') + if: startsWith(fromJSON(steps.pr.outputs.result).head_ref, 'changeset-release') uses: changesets/action@v1 with: publish: npm run publish-packages @@ -78,25 +98,6 @@ jobs: result=${result%\\n} echo "published_packages=$result" >> $GITHUB_OUTPUT - - name: Checkout pull request - id: pr - uses: actions/github-script@v7 - with: - script: | - const result = (await github.rest.repos.listPullRequestsAssociatedWithCommit({ - commit_sha: context.sha, - owner: context.repo.owner, - repo: context.repo.repo, - })).data[0]; - - return { - commit: result.merge_commit_sha.substring(0, 7), - number: result.number, - title: result.title, - url: result.html_url, - avatar_url: context.payload.repository.owner.avatar_url - }; - send_slack_message: needs: run-changesets name: Send slack message