Skip to content

Commit

Permalink
ci: set minimal permissions to workflows (#7070)
Browse files Browse the repository at this point in the history
* ci: set minimal permissions to workflows

Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>

* Fix trailing whitespace on playwright-update.yml

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>

---------

Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
  • Loading branch information
diogoteles08 and krassowski committed Sep 25, 2023
1 parent e43da4a commit 5a8c3ad
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/auto_author_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ on:
types: [opened, reopened]

permissions:
pull-requests: write
contents: read

jobs:
assign-author:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: toshimaru/auto-author-assign@v1.6.2
3 changes: 3 additions & 0 deletions .github/workflows/binder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
pull_request_target:
types: [opened]

permissions:
contents: read

jobs:
binder:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- cron: '0 0 * * *'

permissions:
contents: write
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/buildutils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

permissions:
contents: read

jobs:
versioning:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

permissions:
contents: write
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/enforce-label.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Enforce PR label

permissions:
contents: read

on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ on:
- cron: '0 0 * * *'

permissions:
issues: write
pull-requests: write
contents: read

jobs:
lock:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: dessant/lock-threads@v4
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/playwright-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ on:
types: [created, edited]

permissions:
contents: write
pull-requests: write
contents: read

jobs:
update-snapshots:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'update playwright snapshots') }}
runs-on: ubuntu-latest
permissions:
pull-requests: write # Required by actions/update-snapshots
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
description: 'Use PRs with activity since the last stable git tag'
required: false
type: boolean
permissions:
contents: read
jobs:
prep_release:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
description: 'Comma separated list of steps to skip'
required: false

permissions:
contents: read

jobs:
publish_release:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Build
Expand Down

0 comments on commit 5a8c3ad

Please sign in to comment.