Skip to content

Commit 267b5a8

Browse files
authored
Chore: Fix zizmor issues in template workflows (#1823)
1 parent 766728d commit 267b5a8

File tree

5 files changed

+54
-19
lines changed

5 files changed

+54
-19
lines changed

packages/create-plugin/templates/github/workflows/bundle-stats.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ jobs:
2121
steps:
2222
- name: Checkout repository
2323
uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
2426

25-
- uses: grafana/plugin-actions/bundle-size@main
27+
- uses: grafana/plugin-actions/bundle-size@main # zizmor: ignore[unpinned-uses] provided by grafana

packages/create-plugin/templates/github/workflows/ci.yml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ on:
1111
- master
1212
- main
1313

14-
permissions:
15-
contents: write
16-
id-token: write
17-
pull-requests: write
18-
1914
jobs:
2015
build:
2116
name: Build, lint and unit tests
2217
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
2320
outputs:
2421
plugin-id: $\{{ steps.metadata.outputs.plugin-id }}
2522
plugin-version: $\{{ steps.metadata.outputs.plugin-version }}
@@ -29,6 +26,8 @@ jobs:
2926
GRAFANA_ACCESS_POLICY_TOKEN: $\{{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
3027
steps:
3128
- uses: actions/checkout@v4
29+
with:
30+
persist-credentials: false
3231
{{#if_eq packageManagerName "pnpm"}}
3332
# pnpm action uses the packageManager field in package.json to
3433
# understand which version to install.
@@ -68,14 +67,14 @@ jobs:
6867

6968
- name: Test backend
7069
if: steps.check-for-backend.outputs.has-backend == 'true'
71-
uses: magefile/mage-action@v3
70+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
7271
with:
7372
version: latest
7473
args: coverage
7574

7675
- name: Build backend
7776
if: steps.check-for-backend.outputs.has-backend == 'true'
78-
uses: magefile/mage-action@v3
77+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
7978
with:
8079
version: latest
8180
args: buildAll
@@ -108,14 +107,19 @@ jobs:
108107
- name: Package plugin
109108
id: package-plugin
110109
run: |
111-
mv dist $\{{ steps.metadata.outputs.plugin-id }}
112-
zip $\{{ steps.metadata.outputs.archive }} $\{{ steps.metadata.outputs.plugin-id }} -r
110+
mv dist ${PLUGIN_ID}
111+
zip ${ARCHIVE} ${PLUGIN_ID} -r
112+
env:
113+
ARCHIVE: $\{{ steps.metadata.outputs.archive }}
114+
PLUGIN_ID: $\{{ steps.metadata.outputs.plugin-id }}
113115

114116
- name: Check plugin.json
115117
run: |
116118
docker run --pull=always \
117-
-v $PWD/$\{{ steps.metadata.outputs.archive }}:/archive.zip \
119+
-v $PWD/${ARCHIVE}:/archive.zip \
118120
grafana/plugin-validator-cli -analyzer=metadatavalid /archive.zip
121+
env:
122+
ARCHIVE: $\{{ steps.metadata.outputs.archive }}
119123

120124
- name: Archive Build
121125
uses: actions/upload-artifact@v4
@@ -127,6 +131,8 @@ jobs:
127131
resolve-versions:
128132
name: Resolve e2e images
129133
runs-on: ubuntu-latest
134+
permissions:
135+
contents: read
130136
timeout-minutes: 3
131137
needs: build
132138
if: $\{{ needs.build.outputs.has-e2e == 'true' }}
@@ -135,13 +141,20 @@ jobs:
135141
steps:
136142
- name: Checkout
137143
uses: actions/checkout@v4
144+
with:
145+
persist-credentials: false
146+
138147
- name: Resolve Grafana E2E versions
139148
id: resolve-versions
140-
uses: grafana/plugin-actions/e2e-version@main
149+
uses: grafana/plugin-actions/e2e-version@main # zizmor: ignore[unpinned-uses] provided by grafana
141150

142151
playwright-tests:
143152
needs: [resolve-versions, build]
144153
timeout-minutes: 15
154+
permissions:
155+
contents: read
156+
id-token: write
157+
pull-requests: write
145158
strategy:
146159
fail-fast: false
147160
matrix:
@@ -150,6 +163,8 @@ jobs:
150163
runs-on: ubuntu-latest
151164
steps:
152165
- uses: actions/checkout@v4
166+
with:
167+
persist-credentials: false
153168

154169
- name: Download plugin
155170
uses: actions/download-artifact@v4
@@ -182,7 +197,7 @@ jobs:
182197
ANONYMOUS_AUTH_ENABLED=false DEVELOPMENT=false GRAFANA_VERSION=$\{{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=$\{{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
183198
184199
- name: Wait for grafana server
185-
uses: grafana/plugin-actions/wait-for-grafana@main
200+
uses: grafana/plugin-actions/wait-for-grafana@main # zizmor: ignore[unpinned-uses] provided by grafana
186201
with:
187202
url: http://localhost:3000/login
188203

@@ -194,7 +209,7 @@ jobs:
194209
run: {{ packageManagerName }} run e2e
195210

196211
- name: Upload e2e test summary
197-
uses: grafana/plugin-actions/playwright-gh-pages/upload-report-artifacts@main
212+
uses: grafana/plugin-actions/playwright-gh-pages/upload-report-artifacts@main # zizmor: ignore[unpinned-uses] provided by grafana
198213
if: $\{{ always() && !cancelled() }}
199214
with:
200215
upload-report: false
@@ -220,12 +235,19 @@ jobs:
220235

221236
publish-report:
222237
if: $\{{ always() && !cancelled() }}
238+
permissions:
239+
contents: write
240+
id-token: write
241+
pull-requests: write
223242
needs: [playwright-tests]
224243
runs-on: ubuntu-latest
225244
steps:
226245
- uses: actions/checkout@v4
246+
with:
247+
# required for playwright-gh-pages
248+
persist-credentials: true
227249
- name: Publish report
228-
uses: grafana/plugin-actions/playwright-gh-pages/deploy-report-pages@main
250+
uses: grafana/plugin-actions/playwright-gh-pages/deploy-report-pages@main # zizmor: ignore[unpinned-uses] provided by grafana
229251
with:
230252
github-token: $\{{ secrets.GITHUB_TOKEN }}
231253

packages/create-plugin/templates/github/workflows/cp-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
release:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: grafana/plugin-actions/create-plugin-update@main
21+
- uses: grafana/plugin-actions/create-plugin-update@main # zizmor: ignore[unpinned-uses] provided by grafana
2222
# Uncomment to use a fine-grained personal access token instead of default github token
2323
# (For more info on how to generate the token see https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
2424
# with:

packages/create-plugin/templates/github/workflows/is-compatible.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,28 @@ on: [pull_request]
44
jobs:
55
compatibilitycheck:
66
runs-on: ubuntu-latest
7+
permissions:
8+
contents: read
79
steps:
810
- uses: actions/checkout@v4
11+
with:
12+
persist-credentials: false
13+
914
{{#if_eq packageManagerName "pnpm"}}
1015
# pnpm action uses the packageManager field in package.json to
1116
# understand which version to install.
12-
- uses: pnpm/action-setup@v2
17+
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
1318
{{/if_eq}}
19+
1420
- name: Setup Node.js environment
15-
uses: actions/setup-node@v4
21+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1622
with:
1723
node-version: '22'
1824
cache: '{{ packageManagerName }}'
25+
1926
- name: Install dependencies
2027
run: {{ packageManagerInstallCmd }}
28+
2129
- name: Build plugin
2230
run: {{ packageManagerName }} run build
2331
- name: Compatibility check

packages/create-plugin/templates/github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v4
20-
- uses: grafana/plugin-actions/build-plugin@main
20+
with:
21+
persist-credentials: false
22+
23+
- uses: grafana/plugin-actions/build-plugin@main # zizmor: ignore[unpinned-uses] provided by grafana
2124
# Uncomment to enable plugin signing
2225
# (For more info on how to generate the access policy token see https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token)
2326
#with:

0 commit comments

Comments
 (0)