Support Github App
matanbaruch opened this issue · 2 comments
Hey,
Is it possible to use this Github Action using Github App?
We would like to not use Personal Access Token of individual and use a Github App credentials to publish packages
Hi @matanbaruch! I assume that you are asking about publishing to the GitHub registry, since you're referring to GitHub tokens rather than npm tokens.
There is no need to create a Personal Access Token to use this action to publish to the GitHub Registry. Every GitHub Actions job is given a temporary access token automatically, accessible via secrets.GITHUB_TOKEN
. To use it to publish a package, define your workflow to give that token publishing permission:
name: Publish package to GitHub Packages
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # < allow the built-in token to publish packages
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
# ... your project's specific build steps ...
- uses: JS-DevTools/npm-publish@v2
with:
registry: 'https://npm.pkg.github.com'
token: ${{ secrets.GITHUB_TOKEN }}
Edit: I forgot the registry
input when I first commented! Fixed my snippet by adding it
I added the above snippet to the README. Hopefully this example helps!
Because GitHub Actions has ephemeral access tokens built in, I don't see a need for a GitHub Apps integration, so I closed the issue. Please let me know if you have any more questions