From c88962af358838900cf21dd83b742fdb0caf0c28 Mon Sep 17 00:00:00 2001 From: Rafael Benevides Date: Wed, 21 Oct 2026 11:43:23 -0300 Subject: [PATCH 1/5] HYPERFLEET-1806 - ci: add pre-commit secondary checks --- .github/workflows/pre-commit.yml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..57ecec2 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,49 @@ +name: pre-commit + +on: + pull_request: + +permissions: + contents: read + +concurrency: + group: pre-commit-${{ github.ref }} + cancel-in-progress: true + +jobs: + pre-commit: + runs-on: ubuntu-24.04 + timeout-minutes: 30 + env: + CGO_ENABLED: "0" + steps: + - name: Check out source + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up Go + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version-file: go.mod + cache-dependency-path: | + go.sum + tools/go.sum + + - name: Set up Python + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: "3.12" + + - name: Install pre-commit + run: python -m pip install pre-commit==4.6.2 + + - name: Generate ignored Go sources where required + run: | + if grep -q '^generate-all:' Makefile; then + make generate-all + fi + + # This runs pre-commit-stage hooks; PR-title validation stays in Prow. + - name: Run pre-commit hooks + run: pre-commit run --all-files --show-diff-on-failure From f3a7180ccf1024c1c896b3e2d43f7fcbf2226df2 Mon Sep 17 00:00:00 2001 From: Rafael Benevides Date: Wed, 21 Oct 2026 13:38:40 -0300 Subject: [PATCH 2/5] HYPERFLEET-1806 - ci: scope permissions and install project hooks --- .github/workflows/pre-commit.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 57ecec2..bf55255 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,8 +3,7 @@ name: pre-commit on: pull_request: -permissions: - contents: read +permissions: {} concurrency: group: pre-commit-${{ github.ref }} @@ -12,6 +11,8 @@ concurrency: jobs: pre-commit: + permissions: + contents: read runs-on: ubuntu-24.04 timeout-minutes: 30 env: @@ -38,6 +39,9 @@ jobs: - name: Install pre-commit run: python -m pip install pre-commit==4.6.2 + - name: Install Git hooks + run: make install-hooks + - name: Generate ignored Go sources where required run: | if grep -q '^generate-all:' Makefile; then From e519ba7d06b08f7d6cc38bc4da6f69916ec42763 Mon Sep 17 00:00:00 2001 From: Rafael Benevides Date: Wed, 21 Oct 2026 13:48:09 -0300 Subject: [PATCH 3/5] HYPERFLEET-1806 - ci: keep generation only in the API workflow --- .github/workflows/pre-commit.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index bf55255..3fee131 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -42,12 +42,6 @@ jobs: - name: Install Git hooks run: make install-hooks - - name: Generate ignored Go sources where required - run: | - if grep -q '^generate-all:' Makefile; then - make generate-all - fi - # This runs pre-commit-stage hooks; PR-title validation stays in Prow. - name: Run pre-commit hooks run: pre-commit run --all-files --show-diff-on-failure From 253576ef280f1934a5ba55e6be1841710f9de73e Mon Sep 17 00:00:00 2001 From: Rafael Benevides Date: Wed, 21 Oct 2026 13:55:00 -0300 Subject: [PATCH 4/5] HYPERFLEET-1806 - ci: cache compatible pre-commit environments --- .github/workflows/pre-commit.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 3fee131..046e57e 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -17,6 +17,7 @@ jobs: timeout-minutes: 30 env: CGO_ENABLED: "0" + PRE_COMMIT_VERSION: "4.6.2" steps: - name: Check out source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -24,6 +25,7 @@ jobs: persist-credentials: false - name: Set up Go + id: go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version-file: go.mod @@ -32,12 +34,19 @@ jobs: tools/go.sum - name: Set up Python + id: python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.12" + - name: Cache pre-commit environments + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ~/.cache/pre-commit + key: pre-commit-v1-${{ runner.os }}-${{ runner.arch }}-go${{ steps.go.outputs.go-version }}-py${{ steps.python.outputs.python-version }}-pc${{ env.PRE_COMMIT_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit - run: python -m pip install pre-commit==4.6.2 + run: python -m pip install "pre-commit==${PRE_COMMIT_VERSION}" - name: Install Git hooks run: make install-hooks From ba0bfc8a52379578b3306a85b85c3a7366cc2dec Mon Sep 17 00:00:00 2001 From: Rafael Benevides Date: Wed, 21 Oct 2026 14:02:17 -0300 Subject: [PATCH 5/5] HYPERFLEET-1806 - ci: omit unnecessary Git hook registration --- .github/workflows/pre-commit.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 046e57e..09e6780 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -48,9 +48,6 @@ jobs: - name: Install pre-commit run: python -m pip install "pre-commit==${PRE_COMMIT_VERSION}" - - name: Install Git hooks - run: make install-hooks - # This runs pre-commit-stage hooks; PR-title validation stays in Prow. - name: Run pre-commit hooks run: pre-commit run --all-files --show-diff-on-failure