-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Co-authored-by: Steven <[email protected]>
- Loading branch information
1 parent
1f10757
commit 531a036
Showing
1 changed file
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ jobs: | |
# ... etc | ||
``` | ||
|
||
|
||
### Advanced: Canceling Other Workflows | ||
|
||
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: | |
access_token: ${{ github.token }} | ||
``` | ||
|
||
### Advanced: Token Permissions | ||
|
||
No change to permissions is required by default. The instructions below are for improved control over of those permissions. | ||
|
||
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. | ||
|
||
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: | ||
|
||
```yml | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
``` | ||
|
||
_Note_ : This is typical when global access is set to be restrictive. Only this job will elevate those permissions. | ||
|
||
## Contributing | ||
|
||
- Clone this repo | ||
|