Skip to content

Commit 6cd9bd9

Browse files
committed
add zizmor
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent 365d205 commit 6cd9bd9

File tree

9 files changed

+80
-21
lines changed

9 files changed

+80
-21
lines changed

.github/workflows/acceptance-tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ on:
66
pull_request:
77
branches: [ "main" ]
88

9+
permissions: {}
10+
911
jobs:
1012
acceptance-tests:
1113
runs-on: ubuntu-24.04
1214
steps:
1315
- name: Check out
16+
with:
17+
persist-credentials: false
1418
uses: actions/checkout@v4
15-
- uses: jdx/mise-action@v2
19+
- uses: jdx/mise-action@7a111ead46986ccad89a74ad013ba2a7c08c9e67 # v2.1.1
1620
- name: Run acceptance tests
1721
run: mise run acceptance-test

.github/workflows/build.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ on:
66
pull_request:
77
branches: [ "main" ]
88

9+
permissions: {}
10+
911
jobs:
1012
build:
1113
runs-on: ubuntu-24.04
1214
steps:
1315
- uses: actions/checkout@v4
14-
- uses: jdx/mise-action@v2
16+
with:
17+
persist-credentials: false
18+
- uses: jdx/mise-action@7a111ead46986ccad89a74ad013ba2a7c08c9e67 # v2.1.1
1519
- name: Cache local Maven repository
1620
uses: actions/cache@v4
1721
with:

.github/workflows/github-pages.yaml

+23-15
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ on:
1111
# Allows you to run this workflow manually from the Actions tab
1212
workflow_dispatch:
1313

14-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15-
permissions:
16-
contents: read
17-
pages: write
18-
id-token: write
14+
permissions: {}
1915

2016
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
2117
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
@@ -37,50 +33,62 @@ jobs:
3733
steps:
3834
- uses: actions/checkout@v4
3935
with:
36+
persist-credentials: false
4037
fetch-tags: 'true'
4138
fetch-depth: 0
42-
- name: Set up JDK
43-
uses: actions/setup-java@v4
39+
- uses: jdx/mise-action@7a111ead46986ccad89a74ad013ba2a7c08c9e67 # v2.1.1
4440
with:
45-
java-version: 17
46-
distribution: temurin
47-
cache: 'maven'
41+
cache: 'false'
4842
- name: Set release version
4943
run: ./scripts/set-release-version-github-pages.sh
50-
- name: Install Hugo CLI
51-
run: |
52-
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
53-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
44+
with:
45+
permissions: block
5446
- name: Make Javadoc
5547
run: ./mvnw -B clean compile javadoc:javadoc javadoc:aggregate -P javadoc
48+
with:
49+
permissions: block
5650
- name: Move the Javadoc to docs/static/api/
5751
run: mv ./target/reports/apidocs ./docs/static/api && echo && echo 'ls ./docs/static/api' && ls ./docs/static/api
52+
with:
53+
permissions: block
5854
- name: Setup Pages
5955
id: pages
6056
uses: actions/configure-pages@v5
6157
- name: Install Node.js dependencies
6258
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
59+
with:
60+
permissions: block
6361
working-directory: ./docs
6462
- name: Build with Hugo
6563
env:
6664
# For maximum backward compatibility with Hugo modules
6765
HUGO_ENVIRONMENT: production
6866
HUGO_ENV: production
67+
BASE_URL: "${{ steps.pages.outputs.base_url }}"
6968
run: |
7069
hugo \
7170
--gc \
7271
--minify \
73-
--baseURL "${{ steps.pages.outputs.base_url }}/"
72+
--baseURL "${BASE_URL}/"
73+
with:
74+
permissions: block
7475
working-directory: ./docs
7576
- name: ls ./docs/public/api
7677
run: echo 'ls ./docs/public/api' && ls ./docs/public/api
78+
with:
79+
permissions: block
7780
- name: Upload artifact
7881
uses: actions/upload-pages-artifact@v3
7982
with:
8083
path: ./docs/public
84+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
8185

8286
# Deployment job
8387
deploy:
88+
permissions:
89+
contents: read
90+
pages: write
91+
id-token: write
8492
environment:
8593
name: github-pages
8694
url: ${{ steps.deployment.outputs.page_url }}

.github/workflows/lint.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Acceptance Tests
3+
4+
on: [pull_request]
5+
6+
permissions: {}
7+
8+
jobs:
9+
acceptance-tests:
10+
permissions: {}
11+
runs-on: ubuntu-24.04
12+
steps:
13+
- name: Check out
14+
with:
15+
persist-credentials: false
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- uses: jdx/mise-action@7a111ead46986ccad89a74ad013ba2a7c08c9e67 # v2.1.1
18+
- name: Lint
19+
run: mise run lint-all
20+

.github/workflows/native-tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ on:
66
pull_request:
77
branches: [ "main" ]
88

9+
permissions: {}
10+
911
jobs:
1012
native-tests:
1113
runs-on: ubuntu-24.04
1214
steps:
1315
- name: Check out
16+
with:
17+
persist-credentials: false
1418
uses: actions/checkout@v4
15-
- uses: jdx/mise-action@v2
19+
- uses: jdx/mise-action@7a111ead46986ccad89a74ad013ba2a7c08c9e67 # v2.1.1
1620
- name: Run native tests
1721
run: mise run native-test

.github/workflows/release.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
deploy:
1010
if: ${{ github.repository == 'prometheus/client_java' }}
1111
runs-on: ubuntu-24.04
12+
permissions: {}
1213

1314
steps:
1415
- name: Debug gpg key - remove after debugging
@@ -19,16 +20,19 @@ jobs:
1920
echo "$GPG_SIGNING_KEY" | gpg --batch --import-options import-show --import
2021
- name: Checkout Plugin Repository
2122
uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
2225

2326
- name: Set Up JDK
2427
uses: actions/setup-java@v4
2528
with:
2629
java-version: 17
2730
distribution: temurin
28-
cache: 'maven'
2931

3032
- name: Build with Maven
31-
run: ./scripts/build-release.sh ${{ github.ref_name }}
33+
run: ./scripts/build-release.sh
34+
env:
35+
TAG: ${{ github.ref_name }}
3236

3337
- name: Set up Apache Maven Central
3438
uses: actions/setup-java@v4

mise.lock

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
[tools."cargo:zizmor"]
2+
version = "1.6.0"
3+
backend = "cargo:zizmor"
4+
5+
[tools."go:github.com/gohugoio/hugo"]
6+
version = "latest"
7+
backend = "go:github.com/gohugoio/hugo"
8+
19
[tools."go:github.com/grafana/oats"]
210
version = "0.3.0"
311
backend = "go:github.com/grafana/oats"

mise.toml

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
PROTO_GENERATION = "true"
33

44
[tools]
5+
"cargo:zizmor" = "latest"
6+
"go:github.com/gohugoio/hugo" = "latest"
57
"go:github.com/grafana/oats" = "latest"
68
java = "temurin-17.0.13+11"
79
protoc = "latest"
@@ -35,6 +37,12 @@ run = "./mvnw verify"
3537
description = "build all modules wihthout tests"
3638
run = "./mvnw install -DskipTests"
3739

40+
[tasks.lint-gh-actions]
41+
run = "zizmor .github/"
42+
43+
[tasks.lint-all]
44+
depends = ["lint-gh-actions"]
45+
3846
[tasks.acceptance-test]
3947
description = "Run OATs acceptance tests"
4048
depends = "build"

scripts/build-release.sh

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
set -euo pipefail
44

5-
TAG=$1
65
VERSION=${TAG#v}
76

87
mvn versions:set -DnewVersion=$VERSION

0 commit comments

Comments
 (0)