Skip to content
name: Check NPM Publish Permissions
on:
push:
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
check-npm-permissions:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org/'
- name: Configure npm authentication
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- name: Check NPM Publish Access
run: |
npm access list packages
- name: Check NPM Authentication
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
curl -H "Authorization: Bearer ${NPM_TOKEN}" https://registry.npmjs.org/-/whoami || echo "Authentication failed"