Skip to content

Commit 2de2023

Browse files
oherralajtt
authored andcommitted
Fix GitHub Actions with hints from zizmor
1 parent cff88a3 commit 2de2023

File tree

4 files changed

+39
-11
lines changed

4 files changed

+39
-11
lines changed

.github/workflows/rust_matrix.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
name: Rust Matrix CI
2+
13
on:
24
push:
35
branches: [ main ]
46
pull_request:
57
branches: [ main ]
68

7-
name: Rust Matrix CI
9+
permissions:
10+
contents: read
811

912
jobs:
1013
test-matrix:
@@ -22,7 +25,9 @@ jobs:
2225
- name: Install dependencies
2326
run: sudo apt -y update && sudo apt -y install flex bison
2427
if: ${{ startsWith(matrix.os, 'ubuntu') }}
25-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
29+
with:
30+
persist-credentials: false
2631
- uses: sensorfu/setup-rust-action@v1
2732
with:
2833
cache-key: ${{ matrix.os }}-${{ matrix.toolchain }}
@@ -41,7 +46,9 @@ jobs:
4146
- x86_64-unknown-linux-musl
4247

4348
steps:
44-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v6
50+
with:
51+
persist-credentials: false
4552
- uses: sensorfu/setup-rust-action@v1
4653
with:
4754
cache-key: ${{ matrix.target }}
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
name: Sanitizers
2+
13
on:
24
push:
35
branches: [ main ]
46
pull_request:
57
branches: [ main ]
68

7-
name: Run Sanitizers
9+
permissions:
10+
contents: read
811

912
jobs:
1013
sanitizers:
@@ -13,21 +16,26 @@ jobs:
1316
matrix:
1417
os: [ ubuntu-latest, macos-latest ]
1518
sanitizer: [ address ]
19+
include:
20+
- os: ubuntu-latest
21+
target: x86_64-unknown-linux-gnu
22+
- os: macos-latest
23+
target: aarch64-apple-darwin
1624

1725
steps:
1826
- name: Install dependencies
1927
run: sudo apt -y update && sudo apt -y install flex bison
2028
if: ${{ startsWith(matrix.os, 'ubuntu') }}
21-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v6
30+
with:
31+
persist-credentials: false
2232
- uses: sensorfu/setup-rust-action@v1
2333
with:
2434
toolchain: nightly
2535
components: rust-src
26-
- run: |
27-
echo "TARGET=$(rustc -vV | awk '/^host: / { print $2 }')" >>${GITHUB_ENV}
28-
- name: Run ${{ matrix.sanitizer }} sanitizer for ${{ env.TARGET }}
36+
- name: Run ${{ matrix.sanitizer }} sanitizer for ${{ matrix.target }}
2937
env:
3038
RUSTFLAGS: -Z sanitizer=${{ matrix.sanitizer }}
3139
RUSTDOCFLAGS: -Z sanitizer=${{ matrix.sanitizer }}
3240
ASAN_OPTIONS: verbose=1:atexit=1:detect_stack_use_after_return=1:strict_string_checks=1
33-
run: cargo test -Zbuild-std --target ${{ env.TARGET }}
41+
run: cargo test -Zbuild-std --target ${{ matrix.target }}

.github/workflows/rust_stable.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1+
name: Rust Stable CI
2+
13
on:
24
push:
35
branches: [ main ]
46
pull_request:
57
branches: [ main ]
68

7-
name: Rust Stable CI
9+
permissions:
10+
contents: read
811

912
jobs:
1013
lints:
1114
runs-on: ubuntu-latest
1215
steps:
1316
- name: Install dependencies
1417
run: sudo apt -y update && sudo apt -y install flex bison
15-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
19+
with:
20+
persist-credentials: false
1621
- uses: sensorfu/setup-rust-action@v1
1722
with:
1823
components: clippy,rustfmt

zizmor.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
# Allow using GitHub Actions' own actions with just version tag
6+
actions/*: ref-pin
7+
# Allow using our own actions with just version tag
8+
sensorfu/*: ref-pin

0 commit comments

Comments
 (0)