From e71f6e774cd2bef585a139019603a487fa1564bb Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Jun 2025 18:20:04 +0100 Subject: [PATCH 1/7] ci: fixes --- .editorconfig | 2 +- .forgejo/actions/prefligit/action.yml | 4 ++-- .forgejo/workflows/prefligit-checks.yml | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 17bb0c17..3e7fd1b8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,6 +23,6 @@ indent_size = 2 indent_style = tab max_line_length = 98 -[{**/*.yml}] +[*.yml] indent_size = 2 indent_style = space diff --git a/.forgejo/actions/prefligit/action.yml b/.forgejo/actions/prefligit/action.yml index 10f47af9..2179695f 100644 --- a/.forgejo/actions/prefligit/action.yml +++ b/.forgejo/actions/prefligit/action.yml @@ -1,6 +1,6 @@ -name: reflighit +name: prefligit description: | - Runs reflighit, pre-commit reimplemented in Rust. + Runs prefligit, pre-commit reimplemented in Rust. inputs: extra_args: description: options to pass to pre-commit run diff --git a/.forgejo/workflows/prefligit-checks.yml b/.forgejo/workflows/prefligit-checks.yml index 8eae8451..fc16a5ca 100644 --- a/.forgejo/workflows/prefligit-checks.yml +++ b/.forgejo/workflows/prefligit-checks.yml @@ -2,6 +2,7 @@ name: Checks / Prefligit on: push: + pull_request: jobs: prefligit: @@ -10,6 +11,10 @@ jobs: FROM_REF: ${{ github.event.pull_request.base.sha || (!github.event.forced && ( github.event.before != '0000000000000000000000000000000000000000' && github.event.before || github.sha )) || format('{0}~', github.sha) }} TO_REF: ${{ github.sha }} steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false - uses: ./.forgejo/actions/prefligit with: extra_args: --from-ref ${{ env.FROM_REF }} --to-ref ${{ env.TO_REF }} --hook-stage manual From 69b6820ffe6bbf6030b0239dd502450e2f3fc87c Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Jun 2025 18:25:38 +0100 Subject: [PATCH 2/7] ci: Install UV --- .forgejo/actions/prefligit/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/actions/prefligit/action.yml b/.forgejo/actions/prefligit/action.yml index 2179695f..62ea9e1c 100644 --- a/.forgejo/actions/prefligit/action.yml +++ b/.forgejo/actions/prefligit/action.yml @@ -10,6 +10,8 @@ inputs: runs: using: composite steps: + - name: Install uv + uses: https://github.com/astral-sh/setup-uv@v6 - name: Install Prefligit shell: bash run: | From d1731fa8a08f4b8018bc909a2f19f8367e378765 Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Jun 2025 18:28:28 +0100 Subject: [PATCH 3/7] ci: Fetch whole git history --- .forgejo/workflows/prefligit-checks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/prefligit-checks.yml b/.forgejo/workflows/prefligit-checks.yml index fc16a5ca..84bbac1f 100644 --- a/.forgejo/workflows/prefligit-checks.yml +++ b/.forgejo/workflows/prefligit-checks.yml @@ -15,6 +15,7 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false + depth: 0 # we need to be able to get diffs - uses: ./.forgejo/actions/prefligit with: extra_args: --from-ref ${{ env.FROM_REF }} --to-ref ${{ env.TO_REF }} --hook-stage manual From d1fa9d2af62d21b8c2a73208e7e6b73b997ad87e Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Jun 2025 18:38:19 +0100 Subject: [PATCH 4/7] cierbose prefligit run --- .forgejo/actions/prefligit/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/actions/prefligit/action.yml b/.forgejo/actions/prefligit/action.yml index 62ea9e1c..987a4b18 100644 --- a/.forgejo/actions/prefligit/action.yml +++ b/.forgejo/actions/prefligit/action.yml @@ -20,5 +20,5 @@ runs: with: path: ~/.cache/prefligit key: prefligit-0|${{ hashFiles('.pre-commit-config.yaml') }} - - run: prefligit run --show-diff-on-failure --color=always ${{ inputs.extra_args }} + - run: prefligit run --show-diff-on-failure --color=always -v ${{ inputs.extra_args }} shell: bash From 552653b460ce080c8e89fcbf55c8885df12024cb Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Jun 2025 18:42:43 +0100 Subject: [PATCH 5/7] ci: Cache uv toolchain --- .forgejo/actions/prefligit/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.forgejo/actions/prefligit/action.yml b/.forgejo/actions/prefligit/action.yml index 987a4b18..8cbd4500 100644 --- a/.forgejo/actions/prefligit/action.yml +++ b/.forgejo/actions/prefligit/action.yml @@ -12,6 +12,9 @@ runs: steps: - name: Install uv uses: https://github.com/astral-sh/setup-uv@v6 + with: + enable-cache: true + ignore-nothing-to-cache: true - name: Install Prefligit shell: bash run: | From 6476cdd9b8f914cd6fecaca9ed435bacc92cb3fc Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Jun 2025 18:46:36 +0100 Subject: [PATCH 6/7] ci: Set permissions explicitly --- .forgejo/workflows/prefligit-checks.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/workflows/prefligit-checks.yml b/.forgejo/workflows/prefligit-checks.yml index 84bbac1f..08c93d12 100644 --- a/.forgejo/workflows/prefligit-checks.yml +++ b/.forgejo/workflows/prefligit-checks.yml @@ -3,6 +3,8 @@ name: Checks / Prefligit on: push: pull_request: +permissions: + contents: read jobs: prefligit: From e61748497aa8d488a25b4d7b453cec9db9d8c475 Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Jun 2025 18:54:15 +0100 Subject: [PATCH 7/7] ci: Pin specific repo version --- .forgejo/workflows/prefligit-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/prefligit-checks.yml b/.forgejo/workflows/prefligit-checks.yml index 08c93d12..6a124ac6 100644 --- a/.forgejo/workflows/prefligit-checks.yml +++ b/.forgejo/workflows/prefligit-checks.yml @@ -14,7 +14,7 @@ jobs: TO_REF: ${{ github.sha }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v4.2.2 with: persist-credentials: false depth: 0 # we need to be able to get diffs