mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-02 21:03:34 +03:00
# Description of Changes The `pre-commit` commands in this repo are inconsistent with the rest of the dev workflow, as they are impossible to run through Task and they can cause CI to fail with no way for a developer to run the `pre-commit` scripts after they've failed. This PR adds `task pre-commit` (and `task pre-commit:fix`) and then hooks up the existing `pre-commit` hooks and CI to call the Task rule, so if developers are using pre-commit hooks then they should still work, but they're also runnable without using pre-commit at all. I think it'd be worth reviewing what we're actually running at pre-commit in the future because I'm not entirely convinced by all of the scripts that we are running, but this should at least make what we have properly enforced and usable by all devs.
37 lines
1002 B
YAML
37 lines
1002 B
YAML
name: Pre-commit
|
|
|
|
# Runs the repo-wide lint/format/secret checks via `task pre-commit`.
|
|
# Called from build.yml on PRs and merge_group; also runnable on demand via workflow_dispatch.
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: Install Task
|
|
uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 # v2.0.0
|
|
|
|
- name: Run pre-commit checks
|
|
run: task pre-commit
|