@@ -10,6 +10,10 @@ name: autofix.ci
1010 required : false
1111 type : boolean
1212
13+ concurrency : # yamllint disable-line rule:key-ordering
14+ cancel-in-progress : true
15+ group : autofix-pre-commit-${{github.event.pull_request.number||github.ref}}
16+
1317permissions :
1418 contents : read
1519
@@ -19,19 +23,22 @@ jobs:
1923 UV_FROZEN : true
2024 UV_NO_SYNC : true
2125 UV_PYTHON_DOWNLOADS : never
26+ name : Run pre-commit hooks and commit any auto-fixes
2227 runs-on : ubuntu-latest
2328
2429 steps :
2530 - uses : actions/checkout@v7
31+ with :
32+ persist-credentials : false
2633
27- - name : Add GB Locale
34+ - name : Add GB locale
2835 run : |
2936 sudo apt-get update
3037 sudo apt-get install -y locales
3138 sudo locale-gen en_GB.UTF-8
3239 shell : bash
3340
34- - name : Set Up Python
41+ - name : Set up Python
3542 uses : actions/setup-python@v6
3643 with :
3744 python-version-file : .python-version
@@ -41,11 +48,11 @@ jobs:
4148 with :
4249 enable-cache : true
4350
44- - name : Install prek From Locked Dependencies
51+ - name : Install prek from locked dependencies
4552 run : uv sync --only-group pre-commit
4653
4754 - id : store-hashed-python-version
48- name : Store Hashed Python Version
55+ name : Store hashed Python version
4956 run : echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
5057 >> "$GITHUB_OUTPUT"
5158
@@ -54,19 +61,25 @@ jobs:
5461 key : prek|${{steps.store-hashed-python-version.outputs.hashed_python_version}}|${{hashFiles('.pre-commit-config.yaml')}}
5562 path : ~/.cache/prek
5663
57- - name : Setup pre-commit Environments
64+ - name : Setup pre-commit environments
5865 run : uv run -- prek install-hooks
5966
6067 - name : Run prek
61- run : |
68+ env : # yamllint disable-line rule:key-ordering
69+ CURRENT_BRANCH_NAME : ${{github.ref_name}}
70+ DEFAULT_BRANCH_NAME : ${{github.event.repository.default_branch}}
71+ run : | # zizmor: ignore[template-injection]
6272 set -o pipefail
63- if [[ "${{github.event_name}}" == "push" && "${{github.ref_name}}" == "${{github.event.repository.default_branch}}" ]]; then
64- uv run -- prek run --all-files --hook-stage manual --color never --skip ruff-check --skip uv-lock --skip gitlint-ci | tee /tmp/prek.log
73+
74+ if [ "${{github.event_name}}" == "push" ] && [ "${CURRENT_BRANCH_NAME}" == "${DEFAULT_BRANCH_NAME}" ]; then
75+ ARGS=("--skip" "gitlint-ci")
6576 else
66- uv run -- prek run --all-files --hook-stage manual --color never --skip ruff-check --skip uv-lock | tee /tmp/prek.log
77+ ARGS=()
6778 fi
6879
69- - name : Ensure No Warnings
80+ uv run -- prek run --all-files --hook-stage manual --color never --skip ruff-check --skip uv-lock "${ARGS[@]}" | tee /tmp/prek.log
81+
82+ - name : Ensure no warnings
7083 run : " if grep -q '^warning: ' /tmp/prek.log; then exit 1; fi"
7184
7285 - if : " !cancelled() && inputs.skip-autofix != true"
0 commit comments