Skip to content

Commit 5bd26b0

Browse files
committed
feat: use GitHub App token for GitHub Packages authentication
- Generate GitHub App token using GH_APP_ID and GH_APP_PRIVATE_KEY secrets - Replace GITHUB_TOKEN with GitHub App token for npm.pkg.github.com - GitHub App tokens have proper packages:write permissions for org packages - Should resolve 'Permission installation not allowed' error
1 parent 1c5e4db commit 5bd26b0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ jobs:
183183
# Get the latest commit (including badge updates)
184184
ref: main
185185

186+
- name: Generate GitHub App Token
187+
id: app-token
188+
uses: actions/create-github-app-token@v1
189+
with:
190+
app-id: ${{ secrets.GH_APP_ID }}
191+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
192+
owner: ExaDev
193+
186194
- name: Setup Node.js
187195
uses: actions/setup-node@v4
188196
with:
@@ -388,15 +396,15 @@ jobs:
388396
NPMJS_NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
389397
NPMJS_NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
390398
GITHUB_NPM_CONFIG_REGISTRY: https://npm.pkg.github.com
391-
GITHUB_NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
399+
GITHUB_NODE_AUTH_TOKEN: ${{ steps.app-token.outputs.token }}
392400
run: |
393401
echo "🚀 Starting semantic-release with staged README and badge updates..."
394402
395403
# Set up .npmrc for both registries
396404
cat > .npmrc << EOF
397405
registry=https://registry.npmjs.org/
398406
//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
399-
//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}
407+
//npm.pkg.github.com/:_authToken=${{ steps.app-token.outputs.token }}
400408
@ExaDev:registry=https://npm.pkg.github.com
401409
EOF
402410

0 commit comments

Comments
 (0)