Skip to content

Commit 6fcc924

Browse files
authored
Cleanup github actions files (#367)
1 parent 1697a46 commit 6fcc924

File tree

7 files changed

+61
-18
lines changed

7 files changed

+61
-18
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
2424
steps:
2525
- uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
2628

2729
- name: Setup Node.js environment
2830
uses: actions/setup-node@v4
@@ -52,13 +54,13 @@ jobs:
5254
cache-dependency-path: "**/*.sum"
5355

5456
- name: Test backend
55-
uses: magefile/mage-action@v3
57+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
5658
with:
5759
version: latest
5860
args: coverage
5961

6062
- name: Build backend
61-
uses: magefile/mage-action@v3
63+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
6264
with:
6365
version: latest
6466
args: build:linux
@@ -82,9 +84,12 @@ jobs:
8284
8385
- name: Package plugin
8486
id: package-plugin
87+
env:
88+
PLUGIN_ID: ${{ steps.metadata.outputs.plugin-id }}
89+
ARCHIVE: ${{ steps.metadata.outputs.archive }}
8590
run: |
86-
mv dist ${{ steps.metadata.outputs.plugin-id }}
87-
zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r
91+
mv dist "$PLUGIN_ID"
92+
zip "$ARCHIVE" "$PLUGIN_ID" -r
8893
8994
- name: Archive Build
9095
uses: actions/upload-artifact@v4

.github/workflows/e2e.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44

55
permissions:
66
contents: read
7-
id-token: write
87

98
concurrency:
109
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -20,6 +19,9 @@ jobs:
2019
steps:
2120
- name: Checkout
2221
uses: actions/checkout@v4
22+
with:
23+
persist-credentials: false
24+
2325
- name: Resolve Grafana E2E versions
2426
id: resolve-versions
2527
uses: grafana/plugin-actions/e2e-version@main
@@ -28,6 +30,8 @@ jobs:
2830

2931
playwright-tests:
3032
needs: resolve-versions
33+
permissions:
34+
id-token: write
3135
timeout-minutes: 60
3236
strategy:
3337
fail-fast: false
@@ -42,6 +46,8 @@ jobs:
4246
run: echo "Running for ${{ matrix.GRAFANA_IMAGE.name }}@${{ matrix.GRAFANA_IMAGE.VERSION }}"
4347

4448
- uses: actions/checkout@v4
49+
with:
50+
persist-credentials: false
4551

4652
- name: Setup Node.js environment
4753
uses: actions/setup-node@v4
@@ -53,7 +59,7 @@ jobs:
5359
run: yarn install
5460

5561
- name: Install Mage
56-
uses: magefile/mage-action@v3
62+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
5763
with:
5864
install-only: true
5965

@@ -72,12 +78,7 @@ jobs:
7278
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
7379
7480
- name: Wait for Grafana to start
75-
uses: nev7n/wait_for_response@v1
76-
with:
77-
url: 'http://localhost:3000/'
78-
responseCode: 200
79-
timeout: 60000
80-
interval: 500
81+
uses: grafana/plugin-actions/wait-for-grafana@main
8182

8283
- name: Run Playwright tests
8384
id: run-tests

.github/workflows/is-compatible.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
name: Latest Grafana API compatibility check
22
on: [pull_request]
3+
permissions: {}
34

45
jobs:
56
compatibilitycheck:
67
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
710
steps:
811
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
914
- name: Setup Node.js environment
1015
uses: actions/setup-node@v4
1116
with:

.github/workflows/issue_commands.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ name: Run commands when issues are labeled
22
on:
33
issues:
44
types: [labeled, unlabeled]
5+
permissions: {}
56
jobs:
67
main:
8+
permissions:
9+
contents: read
10+
issues: write
711
runs-on: ubuntu-latest
812
steps:
913
- name: Checkout Actions
@@ -12,14 +16,22 @@ jobs:
1216
repository: 'grafana/grafana-github-actions'
1317
path: ./actions
1418
ref: main
19+
persist-credentials: false
1520
- name: Install Actions
1621
run: npm install --production --prefix ./actions
22+
- name: Get secrets from vault
23+
id: get-secrets
24+
uses: grafana/shared-workflows/actions/get-vault-secrets@main
25+
with:
26+
repo_secrets: |
27+
AWS_DS_TOKEN_CREATOR_ID=aws-ds-token-creator:app_id
28+
AWS_DS_TOKEN_CREATOR_PEM=aws-ds-token-creator:pem
1729
- name: 'Generate token'
1830
id: generate_token
1931
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
2032
with:
21-
app_id: ${{ secrets.AWS_DS_TOKEN_CREATOR_ID }}
22-
private_key: ${{ secrets.AWS_DS_TOKEN_CREATOR_PEM }}
33+
app_id: ${{ env.AWS_DS_TOKEN_CREATOR_ID }}
34+
private_key: ${{ env.AWS_DS_TOKEN_CREATOR_PEM }}
2335
- name: Run Commands
2436
uses: ./actions/commands
2537
with:

.github/workflows/pr-commands.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,36 @@ on:
66
- opened
77
concurrency:
88
group: pr-commands-${{ github.event.number }}
9+
permissions: {}
910
jobs:
1011
main:
1112
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: write
1216
steps:
1317
- name: Checkout Actions
1418
uses: actions/checkout@v4
1519
with:
1620
repository: 'grafana/grafana-github-actions'
1721
path: ./actions
1822
ref: main
23+
persist-credentials: false
1924
- name: Install Actions
2025
run: npm install --production --prefix ./actions
26+
- name: Get secrets from vault
27+
id: get-secrets
28+
uses: grafana/shared-workflows/actions/get-vault-secrets@main
29+
with:
30+
repo_secrets: |
31+
AWS_DS_TOKEN_CREATOR_ID=aws-ds-token-creator:app_id
32+
AWS_DS_TOKEN_CREATOR_PEM=aws-ds-token-creator:pem
2133
- name: 'Generate token'
2234
id: generate_token
2335
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
2436
with:
25-
app_id: ${{ secrets.AWS_DS_TOKEN_CREATOR_ID }}
26-
private_key: ${{ secrets.AWS_DS_TOKEN_CREATOR_PEM }}
37+
app_id: ${{ env.AWS_DS_TOKEN_CREATOR_ID }}
38+
private_key: ${{ env.AWS_DS_TOKEN_CREATOR_PEM }}
2739
- name: Run Commands
2840
uses: ./actions/commands
2941
with:

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ on:
77
tags:
88
- 'v*' # Run workflow on version tags, e.g. v1.0.0.
99

10-
permissions:
11-
contents: write
10+
permissions: {}
1211

1312
jobs:
1413
release:
@@ -17,6 +16,8 @@ jobs:
1716
runs-on: ubuntu-latest
1817
steps:
1918
- uses: actions/checkout@v4
19+
with:
20+
persist-credentials: false
2021
- uses: grafana/plugin-actions/build-plugin@release
2122
with:
2223
policy_token: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}

.github/zizmor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
actions/*: any
6+
github/*: any
7+
grafana/*: any

0 commit comments

Comments
 (0)