Skip to content

Commit

Permalink
fix: Set explicit permissions in shared workflows (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish authored Dec 9, 2024
1 parent 1dc75cf commit f0ad5ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions set-commit-status/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ from workflows with non-PR triggers (such as manually-triggered workflows).
To use this in a step, write something like:

```yaml
permissions:
# "Write" to statuses to update commit status
statuses: write

steps:
- name: Report final commit status
# Will run on success or failure, but not if the workflow is cancelled
# or if we were asked to ignore the test status.
Expand All @@ -17,3 +22,8 @@ To use this in a step, write something like:
state: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
```
## Permissions
A GitHub-generated token requires "write" permission to "statuses" to be able to
set the commit status.
5 changes: 5 additions & 0 deletions sync-labels/sync-labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:
jobs:
sync-labels:
runs-on: ubuntu-latest

permissions:
# "Write" to Issues to manage labels for the repo
issues: write

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
7 changes: 7 additions & 0 deletions update-issues/update-issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ permissions:
jobs:
update-issues:
runs-on: ubuntu-latest

permissions:
# "Write" to Issues to add labels, milestones, comments, etc.
issues: write
# "Write" to Pull Requests for the same.
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down

0 comments on commit f0ad5ac

Please sign in to comment.