From 59269f381dcae7a54af3976059b2f6b13f06832b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=87=AF90331?= <90331@sangfor.com> Date: Thu, 14 May 2026 17:25:05 +0800 Subject: [PATCH] fix(ci): correct boolean condition for workflow dispatch inputs GitHub Actions workflow_dispatch boolean inputs are strings in expressions ('true'/'false'). Non-empty strings are always truthy, so !inputs.dry_run always evaluated to false. Use explicit string comparison to fix version sync and publish step gating. Co-authored-by: CoStrict --- .github/workflows/publish-npm.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 1562b0b10..f79b87a7d 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -36,7 +36,7 @@ jobs: echo "tag=${TAG}" >> "$GITHUB_OUTPUT" - name: Sync package version - if: ${{ github.event_name == 'workflow_dispatch' && !github.event.inputs.dry_run }} + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run != 'true' }} run: | VERSION="${{ steps.version.outputs.raw }}" # Update package.json @@ -91,19 +91,19 @@ jobs: # run: bun test - name: Publish to npm - if: ${{ !github.event.inputs.dry_run }} + if: ${{ github.event.inputs.dry_run != 'true' }} run: npm publish --provenance --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Publish to npm (dry-run) - if: ${{ github.event.inputs.dry_run }} + if: ${{ github.event.inputs.dry_run == 'true' }} run: npm publish --dry-run --provenance --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Generate changelog - if: ${{ !github.event.inputs.dry_run }} + if: ${{ github.event.inputs.dry_run != 'true' }} id: changelog run: | VERSION="${{ steps.version.outputs.tag }}" @@ -122,7 +122,7 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Create GitHub Release - if: ${{ !github.event.inputs.dry_run }} + if: ${{ github.event.inputs.dry_run != 'true' }} uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2, 2026-04-25 with: tag_name: ${{ steps.version.outputs.tag }}