Skip to content

Commit 69c176b

Browse files
use app token
1 parent 915966b commit 69c176b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/self-zizmor.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,35 @@ jobs:
2727
FOUND_FILES=true
2828
fi
2929
echo "found-files=${FOUND_FILES}" >> $GITHUB_OUTPUT
30+
get-github-token:
31+
name: Get GitHub Token
32+
runs-on: ${{ !github.event.repository.private && 'ubuntu-latest' || 'ubuntu-arm64-small' }}
33+
outputs:
34+
token: ${{ steps.set-output.outputs.token }}
35+
steps:
36+
- id: get-secrets
37+
uses: grafana/shared-workflows/actions/[email protected]
38+
with:
39+
# Secrets placed in the ci/common/<path> path in Vault
40+
common_secrets: |
41+
ZIZMOR_APP_ID=zizmor:app-id
42+
ZIZMOR_PRIVATE_KEY=zizmor:private-key
43+
- name: Get GitHub Token
44+
id: get-github-token
45+
uses: actions/create-github-app-token@v2
46+
continue-on-error: true
47+
with:
48+
app-id: ${{ env.ZIZMOR_APP_ID }}
49+
private-key: ${{ env.ZIZMOR_PRIVATE_KEY }}
50+
owner: ${{ github.repository_owner }}
51+
52+
- name: Set Output
53+
id: set-output
54+
shell: bash
55+
env:
56+
TOKEN: ${{ steps.get-github-token.outputs.token || github.token}}
57+
run: |
58+
echo "token=${TOKEN}" >> $GITHUB_OUTPUT
3059
zizmor:
3160
name: Run zizmor from current branch (self test)
3261

@@ -39,6 +68,7 @@ jobs:
3968

4069
needs:
4170
- zizmor-check
71+
- get-github-token
4272
if: ${{ needs.zizmor-check.outputs.found-files == 'true' }}
4373

4474
uses: grafana/shared-workflows/.github/workflows/reusable-zizmor.yml@b502a15952bab7f72daa1f8ce115491a6d97be59
@@ -47,3 +77,4 @@ jobs:
4777
fail-severity: never
4878
min-severity: high
4979
min-confidence: low
80+
github-token: ${{ needs.get-github-token.outputs.token }}

0 commit comments

Comments
 (0)