Skip to content

Commit 9491ee6

Browse files
use app token (#32)
* use app token * allow id-token
1 parent 915966b commit 9491ee6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/self-zizmor.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,37 @@ 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+
permissions:
36+
id-token: write
37+
steps:
38+
- id: get-secrets
39+
uses: grafana/shared-workflows/actions/[email protected]
40+
with:
41+
# Secrets placed in the ci/common/<path> path in Vault
42+
common_secrets: |
43+
ZIZMOR_APP_ID=zizmor:app-id
44+
ZIZMOR_PRIVATE_KEY=zizmor:private-key
45+
- name: Get GitHub Token
46+
id: get-github-token
47+
uses: actions/create-github-app-token@v2
48+
continue-on-error: true
49+
with:
50+
app-id: ${{ env.ZIZMOR_APP_ID }}
51+
private-key: ${{ env.ZIZMOR_PRIVATE_KEY }}
52+
owner: ${{ github.repository_owner }}
53+
54+
- name: Set Output
55+
id: set-output
56+
shell: bash
57+
env:
58+
TOKEN: ${{ steps.get-github-token.outputs.token || github.token}}
59+
run: |
60+
echo "token=${TOKEN}" >> $GITHUB_OUTPUT
3061
zizmor:
3162
name: Run zizmor from current branch (self test)
3263

@@ -39,6 +70,7 @@ jobs:
3970

4071
needs:
4172
- zizmor-check
73+
- get-github-token
4274
if: ${{ needs.zizmor-check.outputs.found-files == 'true' }}
4375

4476
uses: grafana/shared-workflows/.github/workflows/reusable-zizmor.yml@b502a15952bab7f72daa1f8ce115491a6d97be59
@@ -47,3 +79,4 @@ jobs:
4779
fail-severity: never
4880
min-severity: high
4981
min-confidence: low
82+
github-token: ${{ needs.get-github-token.outputs.token }}

0 commit comments

Comments
 (0)