Skip to content

Commit

Permalink
CI: Move permissions from workflow-level to job-level
Browse files Browse the repository at this point in the history
This is a no-op for most of these since they have a single job, but in
the case of docs this does restrict the contents write permission to
just deployment, and not build.
  • Loading branch information
dopplershift committed Dec 6, 2024
1 parent 1350863 commit 25c523d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/assign-milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
types: [closed]
branches: [main]

permissions:
pull-requests: write
issues: write

jobs:
sync:
permissions:
pull-requests: write
issues: write

name: Assign Latest Milestone
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/backport-prs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Backport PRs

permissions:
pull-requests: write
contents: write

on:
pull_request_target:
types:
Expand All @@ -14,6 +10,10 @@ jobs:
Backport:
runs-on: ubuntu-latest
if: github.event.pull_request.merged && contains( github.event.pull_request.labels.*.name, 'backport' )
permissions:
pull-requests: write
contents: write

steps:
- name: Checkout PR HEAD
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ on:
schedule:
- cron: '0 8 * * 6'

permissions:
contents: read
security-events: write

jobs:
CodeQL:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write

steps:
- name: Checkout repository
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:

permissions:
contents: write

concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -66,6 +63,8 @@ jobs:
runs-on: ubuntu-latest
env:
DOC_VERSION: dev
permissions:
contents: write

steps:
- name: Download doc build
Expand Down

0 comments on commit 25c523d

Please sign in to comment.