Skip to content

Big documentation update #1398

Big documentation update

Big documentation update #1398

name: autofix.ci
"on":
pull_request:
branches: [main]
workflow_call:
inputs:
skip-autofix:
default: false
required: false
type: boolean
concurrency: # yamllint disable-line rule:key-ordering
cancel-in-progress: true
group: autofix-pre-commit-${{github.event.pull_request.number||github.ref}}
permissions:
contents: read
jobs:
autofix-pre-commit:
env:
UV_FROZEN: true
UV_NO_SYNC: true
UV_PYTHON_DOWNLOADS: never
name: Run pre-commit hooks and commit any auto-fixes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Add GB locale
run: |
sudo apt-get update
sudo apt-get install -y locales
sudo locale-gen en_GB.UTF-8
shell: bash
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version-file: .python-version
- name: Install uv
uses: astral-sh/setup-uv@v8.3.2
with:
enable-cache: true
- name: Install prek from locked dependencies
run: uv sync --only-group pre-commit
- id: store-hashed-python-version
name: Store hashed Python version
run: echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
>> "$GITHUB_OUTPUT"
- uses: actions/cache@v6
with:
key: prek|${{steps.store-hashed-python-version.outputs.hashed_python_version}}|${{hashFiles('.pre-commit-config.yaml')}}
path: ~/.cache/prek
- name: Setup pre-commit environments
run: uv run -- prek install-hooks
- name: Run prek
env: # yamllint disable-line rule:key-ordering
CURRENT_BRANCH_NAME: ${{github.ref_name}}
DEFAULT_BRANCH_NAME: ${{github.event.repository.default_branch}}
run: | # zizmor: ignore[template-injection]
set -o pipefail
if [ "${{github.event_name}}" == "push" ] && [ "${CURRENT_BRANCH_NAME}" == "${DEFAULT_BRANCH_NAME}" ]; then
ARGS=("--skip" "gitlint-ci")
else
ARGS=()
fi
uv run -- prek run --all-files --hook-stage manual --color never --skip ruff-check --skip uv-lock "${ARGS[@]}" | tee /tmp/prek.log
- name: Ensure no warnings
run: "if grep -q '^warning: ' /tmp/prek.log; then exit 1; fi"
- if: "!cancelled() && inputs.skip-autofix != true"
uses: autofix-ci/action@v1.3.4