From 6b26138642d1de54742e6bc9a35aad01e80e0b88 Mon Sep 17 00:00:00 2001 From: MotherSphere Date: Fri, 9 Oct 2026 14:41:06 +0200 Subject: [PATCH] ci: run pull request checks with a read-only token and re-pin the toolchain action --- .github/workflows/ci.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a1720c..9c91f16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,10 @@ on: pull_request: branches: [main] +# Read-only by default. A job that needs more asks for it by name. +permissions: + contents: read + env: CARGO_TERM_COLOR: always @@ -24,11 +28,15 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable branch + # Pinned to master with `toolchain: stable` rather than to the `stable` + # branch: that branch is rebased onto every master commit, so a SHA + # pinned on it stops being reachable from any branch. Bumped by hand. + - uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master, 2026-10-09 with: + toolchain: stable components: clippy - - uses: Swatinem/rust-cache@f0d9c3887740aee45f6153b24b3a6b815192ec16 # v2 + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 - name: Format run: cargo fmt --all -- --check @@ -76,11 +84,11 @@ jobs: [ -n "$version" ] || { echo "::error::could not read rust-version from Cargo.toml"; exit 1; } echo "version=$version" >> "$GITHUB_OUTPUT" - - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable branch + - uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master, 2026-10-09 with: toolchain: ${{ steps.msrv.outputs.version }} - - uses: Swatinem/rust-cache@f0d9c3887740aee45f6153b24b3a6b815192ec16 # v2 + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 with: key: msrv-${{ steps.msrv.outputs.version }} @@ -107,6 +115,10 @@ jobs: audit: name: Advisories runs-on: ubuntu-latest + # audit-check reports the advisories as a check run. + permissions: + contents: read + checks: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0