Skip to content

Commit 5c07126

Browse files
committed
ci: add workflow to check NPM authentication
Manual workflow to verify NPM_TOKEN is still valid after npm's token revocation. Includes optional dry-run publish test. Trigger via: Actions → Check NPM Authentication → Run workflow
1 parent 27c3050 commit 5c07126

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Check NPM Authentication
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run_publish:
7+
description: 'Also run npm publish --dry-run to test full publish flow'
8+
required: false
9+
default: false
10+
type: boolean
11+
12+
jobs:
13+
check-npm-auth:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Check NPM authentication
25+
env:
26+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27+
run: |
28+
echo "🔐 Checking NPM authentication..."
29+
echo "---"
30+
31+
if npm whoami; then
32+
echo "---"
33+
echo "✅ NPM authentication successful!"
34+
echo "You are logged in and ready to publish."
35+
else
36+
echo "---"
37+
echo "❌ NPM authentication failed!"
38+
echo "The NPM_TOKEN secret may be invalid or revoked."
39+
echo "Please generate a new token at https://www.npmjs.com/settings/tokens"
40+
exit 1
41+
fi
42+
43+
- name: Test publish (dry-run)
44+
if: ${{ inputs.dry_run_publish }}
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
working-directory: src
48+
run: |
49+
echo "📦 Building package..."
50+
npm ci
51+
npm run build
52+
53+
echo "🧪 Testing publish (dry-run)..."
54+
cd dist
55+
npm publish --dry-run
56+
57+
echo "✅ Dry-run publish successful!"

0 commit comments

Comments
 (0)