Skip to content

Commit c63d731

Browse files
Switch to autofix.ci (#731)
* Move to autofix.ci * Add `gitIgnoredAuthors` * Add more `gitIgnoredAuthors` to renovate config Signed-off-by: Matt Norton <matt@carrotmanmatt.com> --------- Signed-off-by: Matt Norton <matt@carrotmanmatt.com>
1 parent b21e3c5 commit c63d731

File tree

3 files changed

+84
-57
lines changed

3 files changed

+84
-57
lines changed

.github/renovate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"replacements:all",
2121
"workarounds:all"
2222
],
23+
"gitIgnoredAuthors": [
24+
"autofix-ci@users.noreply.github.com",
25+
"autofix-ci[bot]@users.noreply.github.com",
26+
"114827586+autofix-ci[bot]@users.noreply.github.com"
27+
],
2328
"labels": [
2429
"dependencies"
2530
],
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: autofix.ci
2+
3+
"on":
4+
pull_request:
5+
branches: [main]
6+
workflow_call:
7+
inputs:
8+
skip-autofix:
9+
default: false
10+
required: false
11+
type: boolean
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
autofix-pre-commit:
18+
env:
19+
UV_FROZEN: true
20+
UV_NO_SYNC: true
21+
UV_PYTHON_DOWNLOADS: never
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v6
26+
27+
- name: Add GB Locale
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y locales
31+
sudo locale-gen en_GB.UTF-8
32+
shell: bash
33+
34+
- name: Set Up Python
35+
uses: actions/setup-python@v6
36+
with:
37+
python-version-file: .python-version
38+
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v7
41+
with:
42+
enable-cache: true
43+
44+
- name: Install prek From Locked Dependencies
45+
run: uv sync --only-group pre-commit
46+
47+
- id: store-hashed-python-version
48+
name: Store Hashed Python Version
49+
run: echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
50+
>> "$GITHUB_OUTPUT"
51+
52+
- uses: actions/cache@v5
53+
with:
54+
key: prek|${{steps.store-hashed-python-version.outputs.hashed_python_version}}|${{hashFiles('.pre-commit-config.yaml')}}
55+
path: ~/.cache/prek
56+
57+
- name: Setup pre-commit Environments
58+
run: uv run -- prek install-hooks
59+
60+
- name: Run prek
61+
run: |
62+
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
65+
else
66+
uv run -- prek run --all-files --hook-stage manual --color never --skip ruff-check --skip uv-lock | tee /tmp/prek.log
67+
fi
68+
69+
- name: Ensure No Warnings
70+
run: "if grep -q '^warning: ' /tmp/prek.log; then exit 1; fi"
71+
72+
- if: "!cancelled() && inputs.skip-autofix != true"
73+
uses: autofix-ci/action@v1.3.3

.github/workflows/check-build-deploy.yaml

Lines changed: 6 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ name: Check, Build and Deploy
77
branches: [main]
88
tags: [v*]
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
uv-check:
1215
runs-on: ubuntu-latest
@@ -110,62 +113,9 @@ jobs:
110113
uv run -- mypy "${ARGS[@]}"
111114
112115
pre-commit: # yamllint disable-line rule:key-ordering
113-
env:
114-
UV_FROZEN: true
115-
UV_NO_SYNC: true
116-
UV_PYTHON_DOWNLOADS: never
117-
runs-on: ubuntu-latest
118-
119-
steps:
120-
- uses: actions/checkout@v6
121-
122-
- name: Add GB Locale
123-
run: |
124-
sudo apt-get update
125-
sudo apt-get install -y locales
126-
sudo locale-gen en_GB.UTF-8
127-
shell: bash
128-
129-
- name: Set Up Python
130-
uses: actions/setup-python@v6
131-
with:
132-
python-version-file: .python-version
133-
134-
- name: Install uv
135-
uses: astral-sh/setup-uv@v7
136-
with:
137-
enable-cache: true
138-
139-
- name: Install prek From Locked Dependencies
140-
run: uv sync --only-group pre-commit
141-
142-
- id: store-hashed-python-version
143-
name: Store Hashed Python Version
144-
run: echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
145-
>> "$GITHUB_OUTPUT"
146-
147-
- uses: actions/cache@v5
148-
with:
149-
key: prek|${{steps.store-hashed-python-version.outputs.hashed_python_version}}|${{hashFiles('.pre-commit-config.yaml')}}
150-
path: ~/.cache/prek
151-
152-
- name: Setup pre-commit Environments
153-
run: uv run -- prek install-hooks
154-
155-
- name: Run prek
156-
run: |
157-
set -o pipefail
158-
if [[ "${{github.event_name}}" == "push" && "${{github.ref_name}}" == "${{github.event.repository.default_branch}}" ]]; then
159-
uv run -- prek run --all-files --hook-stage manual --color never --skip ruff-check --skip uv-lock --skip gitlint-ci | tee /tmp/prek.log
160-
else
161-
uv run -- prek run --all-files --hook-stage manual --color never --skip ruff-check --skip uv-lock | tee /tmp/prek.log
162-
fi
163-
164-
- name: Ensure No Warnings
165-
run: "if grep -q '^warning: ' /tmp/prek.log; then exit 1; fi"
166-
167-
- if: ${{!cancelled()}}
168-
uses: pre-commit-ci/lite-action@v1.1.0
116+
uses: ./.github/workflows/autofix-pre-commit.yaml
117+
with:
118+
skip-autofix: true
169119

170120
pymarkdown: # yamllint disable-line rule:key-ordering
171121
env:
@@ -290,7 +240,6 @@ jobs:
290240
needs: [mypy, pre-commit, pymarkdown, pytest, ruff-lint, uv-check]
291241
permissions:
292242
attestations: write
293-
contents: read
294243
id-token: write
295244
packages: write
296245
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)