Skip to content

Commit

Permalink
ci: Only pass build-steps the secrets it needs (#4576)
Browse files Browse the repository at this point in the history
Safer than letting it inherit all secrets.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz authored Jan 8, 2025
1 parent 85ece69 commit 424e396
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ jobs:
# account credentials.
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
uses: ./.github/workflows/build-steps.yml
# Must let the called steps workflow inherit our secrets
secrets: inherit
# Must let the called steps workflow inherit necessary secrets
secrets:
PASSED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PASSED_SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
nametag: ${{ matrix.nametag || 'unnamed!' }}
runner: ${{ matrix.runner || 'ubuntu-latest' }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ on:
type: string
nametag:
type: string
secrets:
PASSED_GITHUB_TOKEN:
required: false
PASSED_SONAR_TOKEN:
required: false

permissions: read-all

Expand Down Expand Up @@ -145,8 +150,8 @@ jobs:
- name: Sonar-scanner
if: inputs.sonar == 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PASSED_GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.PASSED_SONAR_TOKEN }}
run: |
which sonar-scanner
ls -l /__w/OpenImageIO/OpenImageIO/bw_output
Expand Down

0 comments on commit 424e396

Please sign in to comment.