Skip to content

Commit 1fdd4be

Browse files
authored
Merge pull request #272 from streamflow-finance/fix/validate-npm-token-before-publishing
Add NPM token validation to GitHub publish workflow
2 parents ac2c81c + 3ce8586 commit 1fdd4be

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/gh-publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ jobs:
3737
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
3838
env:
3939
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Validate NPM Token
41+
run: |
42+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
43+
npm whoami
44+
if [ $? -ne 0 ]; then
45+
echo "::error::NPM token validation failed. Please check your NPM_PUBLISH_TOKEN secret."
46+
exit 1
47+
fi
48+
echo "NPM token validated successfully."
49+
rm -f .npmrc
50+
env:
51+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
4052
- name: Set Current Version
4153
run: |
4254
CURRENT_VERSION=$(node -p 'require("./lerna.json").version')

0 commit comments

Comments
 (0)