8000 Restrict permissions of GitHub Actions by chvmvd · Pull Request #37 · rossjrw/pr-preview-action · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Restrict permissions of GitHub Actions #37

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .github/workflows/deploy-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/preview-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- reopened
- synchronize
- closed
permissions:
contents: write
pull-requests: write
concurrency: preview-${{ github.ref }}
jobs:
deploy-preview:
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ on:
- synchronize
- closed

permissions:
contents: write
pull-requests: write

concurrency: preview-${{ github.ref }}

jobs:
Expand Down Expand Up @@ -105,13 +109,6 @@ for the `pull_request` event. It only comes with `opened`, `reopened`, and
the preview should be removed during the `closed` event, which it only sees
if you explicitly add it to the workflow.

#### Grant Actions permission to read and write to the repository

This must be changed in the repository settings by selecting "Read and
write permissions" at **Settings** > **Actions** > **General** >
**Workflow permissions**. Otherwise, the Action won't be able to make any
changes to your deployment branch.

#### Set a concurrency group

I highly recommend [setting a concurrency
Expand Down Expand Up @@ -262,6 +259,9 @@ on:
- reopened
- synchronize
- closed
permissions:
contents: write
pull-requests: write
jobs:
deploy-preview:
runs-on: ubuntu-latest
Expand All @@ -285,6 +285,8 @@ on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy-preview:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -354,6 +356,9 @@ on:
types:
- opened
- synchronize
permissions:
contents: write
pull-requests: write
jobs:
deploy-preview:
runs-on: ubuntu-20.04
Expand Down
0