Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: pre-commit

on:
pull_request:

permissions: {}

concurrency:
group: pre-commit-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
permissions:
contents: read
runs-on: ubuntu-24.04
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
with:
persist-credentials: false

- name: Set up Go
id: 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
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==${PRE_COMMIT_VERSION}"

# 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