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 <zgsm@sangfor.com.cn>
This commit is contained in:
林凯90331 2026-05-14 17:25:05 +08:00
parent 5890d776dd
commit 59269f381d

View File

@ -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 }}