action
action copied to clipboard
Action Needs Permissions to Comment
Bug description
Using the recommended yml from the README.md:
name: Package Size Report
on:
pull_request:
branches: [ master, develop ] # ⬅ Add other branches you want size checks on
jobs:
pkg-size-report:
name: Package Size Report
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14' # ⬅ Specify a version of Node.js to build your app
- name: Package size report
uses: pkg-size/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
results in the following error when the action is triggered:
Solution: add the following to your recommended yml
permissions:
pull-requests: write
Reproduction steps
See above
Environment
-
pkg-size-actionversion: v1.1.1 - Operating System: Local: MacOS 14.2.1, ubuntu-latest on the action itself
- Node version: 20
You can also grant "Read and write permissions" in your repository settings:
https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions
Would you be open to submitting a PR to document this?
FWIW, for this to work in a private repo with restrictive permissions on GITHUB_TOKEN (see last comment)
permissions:
contents: read
pull-requests: write