Skip to content

Commit 531a036

Browse files
chore: add permissions configuration in the README.md (#96)
* Mention permissions configuration in the README.md * Apply suggestions from code review Co-authored-by: Steven <steven@ceriously.com> Co-authored-by: Steven <steven@ceriously.com>
1 parent 1f10757 commit 531a036

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
# ... etc
3030
```
3131

32-
3332
### Advanced: Canceling Other Workflows
3433

3534
In some cases, you may wish to avoid modifying all your workflows and instead create a new workflow that cancels your other workflows. This can be useful when you have a problem with workflows getting queued.
@@ -121,6 +120,29 @@ jobs:
121120
access_token: ${{ github.token }}
122121
```
123122

123+
### Advanced: Token Permissions
124+
125+
No change to permissions is required by default. The instructions below are for improved control over of those permissions.
126+
127+
By default, GitHub creates the `GITHUB_TOKEN` for Actions with some read/write permissions. It may be a good practice to switch to read-only permissions by default. Visit the [dedicated documentation page](https://docs.github.com/en/github/administering-a-repository/managing-repository-settings/disabling-or-limiting-github-actions-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository) for details.
128+
129+
Permissions can be set for all Jobs in a Workflow or a specific Job, see the [reference manual page](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions). `cancel-workflow-action` only requires write access to the `actions` scope, so it is enough to have:
130+
131+
```yml
132+
jobs:
133+
test:
134+
runs-on: ubuntu-latest
135+
permissions:
136+
actions: write
137+
steps:
138+
- name: Cancel Previous Runs
139+
uses: styfle/cancel-workflow-action@0.9.0
140+
with:
141+
access_token: ${{ github.token }}
142+
```
143+
144+
_Note_ : This is typical when global access is set to be restrictive. Only this job will elevate those permissions.
145+
124146
## Contributing
125147

126148
- Clone this repo

0 commit comments

Comments
 (0)