Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Set explicit permissions in shared workflows #42

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading