Skip to content

Commit

Permalink
github: set workflow permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
marquiz committed Jan 23, 2024
1 parent 9ddf702 commit 6962418
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/common-build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
required: false
type: boolean

permissions:
contents: read

jobs:
update-gh-pages:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v1

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/common-build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ on:
required: false
type: string

permissions:
contents: read

jobs:
build-images:
name: Build and publish container images
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/common-codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ on:
required: false
type: boolean

permissions:
contents: read

jobs:
codeql-scan:
runs-on: ubuntu-22.04

permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/common-trivy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
required: false
type: boolean

permissions:
contents: read

jobs:
trivy-scan-licenses:
runs-on: ubuntu-22.04
Expand All @@ -29,6 +32,8 @@ jobs:

trivy-scan-vulns:
runs-on: ubuntu-22.04
permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/common-verify-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Verify code
on:
- workflow_call

permissions:
contents: read

jobs:
build-and-test:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -38,8 +41,14 @@ jobs:

trivy-scan:
uses: "./.github/workflows/common-trivy.yaml"
permissions:
contents: read
security-events: write
with:
upload-to-github-security-tab: true

codeql-scan:
uses: "./.github/workflows/common-codeql.yaml"
permissions:
contents: read
security-events: write
6 changes: 6 additions & 0 deletions .github/workflows/publish-devel-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ on:
push:
branches: ["master"]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
trivy-scan:
uses: "./.github/workflows/common-trivy.yaml"
permissions:
contents: read
security-events: write

publish-images:
uses: "./.github/workflows/common-build-images.yaml"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ on:
- "Makefile"
tags:
- v*

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
update-gh-pages:
uses: "./.github/workflows/common-build-docs.yaml"
permissions:
contents: write
with:
publish: true
11 changes: 11 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@ on:
push:
tags: [ 'v*' ]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
trivy-scan:
uses: "./.github/workflows/common-trivy.yaml"
permissions:
contents: read
security-events: write
with:
export-csv: true

codeql:
uses: "./.github/workflows/common-codeql.yaml"
permissions:
contents: read
security-events: write
with:
export-report: true

Expand All @@ -30,6 +39,8 @@ jobs:

build-packages:
needs: [trivy-scan]
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/verify-periodic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
schedule:
- cron: '30 2 * * *'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
verify-code:
uses: "./.github/workflows/common-verify-code.yaml"

permissions:
contents: read
security-events: write
6 changes: 6 additions & 0 deletions .github/workflows/verify-pr-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ on:
- "docs/**"
- "**.md"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
verify:
uses: "./.github/workflows/common-verify-code.yaml"
permissions:
contents: read
security-events: write
6 changes: 6 additions & 0 deletions .github/workflows/verify-pr-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ on:
- "docs/**"
- "Makefile"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
verify-docs:
uses: "./.github/workflows/common-build-docs.yaml"
permissions:
contents: read
security-events: write

0 comments on commit 6962418

Please sign in to comment.