Skip to content

Commit

Permalink
[chore] restrict workflow steps to necessary permissions (#11973)
Browse files Browse the repository at this point in the history
This updates the prepare release workflow. It:

- adds a top level permission to read-all only
- breaks apart checking for blockers that doesn't need special
permissions
- breaks apart the piece to create an issue that only needs issues:
write
- adds contents: write  to the last piece that creates a commit and a PR

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten authored Jan 2, 2025
1 parent c84f1bd commit b4ae0ba
Showing 1 changed file with 41 additions and 17 deletions.
58 changes: 41 additions & 17 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ on:
current-beta:
required: true
description: Current version (beta, like 0.95.1). Don't include `v`.

permissions: read-all

jobs:
#validate-version format
validate-versions:
validate-versions-format:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -58,10 +60,9 @@ jobs:
exit 1
fi
# Releasing opentelemetry-collector
prepare-release:
check-blockers:
needs:
- validate-versions
- validate-versions-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down Expand Up @@ -91,6 +92,41 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: open-telemetry/opentelemetry-collector-contrib
run: ./.github/workflows/scripts/release-check-build-status.sh

create-release-issue:
needs:
- check-blockers
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
# To keep track of the progress, it might be helpful to create a tracking issue similar to #6067. You are responsible
# for all of the steps under the "Performed by collector release manager" heading. Once the issue is created, you can
# create the individual ones by hovering them and clicking the "Convert to issue" button on the right hand side.
- name: Create issue for tracking release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CANDIDATE_BETA: ${{ inputs.candidate-beta }}
CANDIDATE_STABLE: ${{ inputs.candidate-stable }}
CURRENT_BETA: ${{ inputs.current-beta }}
CURRENT_STABLE: ${{ inputs.current-stable }}
REPO: open-telemetry/opentelemetry-collector
run: ./.github/workflows/scripts/release-create-tracking-issue.sh

# Releasing opentelemetry-collector
prepare-release:
needs:
- check-blockers
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
Expand All @@ -108,15 +144,3 @@ jobs:
CURRENT_BETA: ${{ inputs.current-beta }}
CURRENT_STABLE: ${{ inputs.current-stable }}
run: ./.github/workflows/scripts/release-prepare-release.sh
# To keep track of the progress, it might be helpful to create a tracking issue similar to #6067. You are responsible
# for all of the steps under the "Performed by collector release manager" heading. Once the issue is created, you can
# create the individual ones by hovering them and clicking the "Convert to issue" button on the right hand side.
- name: Create issue for tracking release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CANDIDATE_BETA: ${{ inputs.candidate-beta }}
CANDIDATE_STABLE: ${{ inputs.candidate-stable }}
CURRENT_BETA: ${{ inputs.current-beta }}
CURRENT_STABLE: ${{ inputs.current-stable }}
REPO: open-telemetry/opentelemetry-collector
run: ./.github/workflows/scripts/release-create-tracking-issue.sh

0 comments on commit b4ae0ba

Please sign in to comment.