From 2f0012da64ea1894f32bff956462e052e18829de Mon Sep 17 00:00:00 2001 From: ManulParihar Date: Fri, 18 Sep 2026 12:16:01 +0530 Subject: [PATCH] Allow running the publish workflow by hand A PR merged without the Release label never publishes, and adding the label afterwards does not rerun it. The manual run is limited to main. --- .github/workflows/npm_publish.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml index c6f1c13..8d28cf1 100644 --- a/.github/workflows/npm_publish.yaml +++ b/.github/workflows/npm_publish.yaml @@ -4,6 +4,8 @@ on: pull_request: types: [ closed ] branches: [ "main" ] + # For a merge that went in without the Release label. + workflow_dispatch: permissions: id-token: write @@ -11,13 +13,15 @@ permissions: jobs: publish-npm: - if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'Release') + if: >- + (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || + (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'Release')) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.merge_commit_sha }} + ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }} - uses: actions/setup-node@v4 with: