Skip to content

Add minimum token permissions for all github workflow files #3604

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 7 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
6 changes: 6 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ on:
description: "The pull request # to backport"
required: true

permissions:
contents: read

jobs:
backport:
permissions:
contents: write # required for pushing branches
pull-requests: write # required for creating pull requests
runs-on: ubuntu-latest
steps:
- run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
changelog:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ on:
# * * * * *
- cron: '30 1 * * *'

permissions:
contents: read

jobs:
CodeQL-Build:
permissions:
security-events: write # for github/codeql-action/analyze to upload SARIF results
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/component-owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ name: 'Component Owners'
on:
pull_request_target:

permissions:
contents: read

jobs:
run_self:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/core_contrib_test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
required: true
type: string

permissions:
contents: read

env:
CORE_REPO_SHA: ${{ inputs.CORE_REPO_SHA }}
CONTRIB_REPO_SHA: ${{ inputs.CONTRIB_REPO_SHA }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- 'release/*'
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/misc_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- 'release/*'
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/package-prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ on:
- opentelemetry-instrumentation-google-genai
description: 'Package to be released'
required: true
permissions:
contents: read
run-name: "[Package][${{ inputs.package }}] Prepare patch release"

jobs:
prepare-patch-release:
permissions:
contents: write # required for pushing branches
pull-requests: write # required for creating pull requests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/package-prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
description: 'Package to be released'
required: true

permissions:
contents: read

run-name: "[Package][${{ inputs.package }}] Prepare release"
jobs:
prereqs:
Expand Down Expand Up @@ -92,6 +95,9 @@ jobs:
create-pull-request-against-release-branch:
runs-on: ubuntu-latest
needs: prereqs
permissions:
contents: write # required for pushing branches
pull-requests: write # required for creating pull requests
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -147,6 +153,9 @@ jobs:
create-pull-request-against-main:
runs-on: ubuntu-latest
needs: prereqs
permissions:
contents: write # required for pushing branches
pull-requests: write # required for creating pull requests
steps:
- uses: actions/checkout@v4

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ on:
- opentelemetry-instrumentation-google-genai
description: 'Package to be released'
required: true
permissions:
contents: read
run-name: "[Package][${{ inputs.package }}] Release"
jobs:
release:
permissions:
contents: write # required for creating releases
pull-requests: write # required for creating pull requests
runs-on: ubuntu-latest
steps:
- run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ name: Prepare patch release
on:
workflow_dispatch:

permissions:
contents: read

jobs:
prepare-patch-release:
permissions:
contents: write # required for pushing branches
pull-requests: write # required for creating and editing pull requests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/prepare-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
description: "Pre-release version number? (e.g. 1.9.0rc2)"
required: false

permissions:
contents: read

jobs:
prereqs:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -38,6 +41,9 @@ jobs:
create-pull-request-against-release-branch:
runs-on: ubuntu-latest
needs: prereqs
permissions:
contents: write # required for pushing branches
pull-requests: write # required for creating and editing pull requests
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -120,6 +126,9 @@ jobs:
create-pull-request-against-main:
runs-on: ubuntu-latest
needs: prereqs
permissions:
contents: write # required for pushing branches
pull-requests: write # required for creating and editing pull requests
steps:
- uses: actions/checkout@v4

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ name: Release
on:
workflow_dispatch:

permissions:
contents: read

jobs:
release:
permissions:
contents: write # required for creating releases
runs-on: ubuntu-latest
steps:
- run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- 'release/*'
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- 'release/*'
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- 'release/*'
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
Loading