From ae37acb228afe8dc3ecb8ba8d706ee4d860770dd Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Thu, 23 Apr 2026 20:35:21 +0100 Subject: [PATCH] ci: Don't run clippy & tests if rust files haven't changed --- .forgejo/workflows/prek-checks.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.forgejo/workflows/prek-checks.yml b/.forgejo/workflows/prek-checks.yml index ae8e880d3..aaabcf954 100644 --- a/.forgejo/workflows/prek-checks.yml +++ b/.forgejo/workflows/prek-checks.yml @@ -9,6 +9,7 @@ on: permissions: contents: read + pull-requests: read jobs: fast-checks: @@ -40,10 +41,32 @@ jobs: cargo +nightly fmt --all -- --check && \ echo "✅ Formatting check passed" || \ exit 1 + check-changes: + name: Check changed files + runs-on: ubuntu-latest + outputs: + rust: ${{ steps.filter.outputs.rust }} + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + persist-credentials: false + + - name: Check for file changes + uses: https://github.com/dorny/paths-filter@v4 + id: filter + with: + filters: | + rust: + - '**/*.rs' + - '**/Cargo.toml' + - '**/Cargo.lock' clippy-and-tests: name: Clippy and Cargo Tests runs-on: ubuntu-latest + needs: check-changes + if: needs.check-changes.outputs.rust == 'true' steps: - name: Checkout repository