mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
# Description of Changes Adds all pre commit PR checks under single file with job validator to have a true "required" run step "all-checks-passed" check Moves all GHAs into workflow helper function calls Note if: always() overrides the default skip-on-needs-failure, "Needs" is added to ensure the validation runs at end of all other tasks --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have run `task check` to verify linters, typechecks, and tests pass - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details.
52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
name: Pre-commit
|
|
|
|
# Runs `pre-commit run` for ruff / codespell / gitleaks / EOF / trailing-ws.
|
|
# Called from build.yml on PRs and merge_group; also runnable on demand via
|
|
# workflow_dispatch for manual local-equivalent linting.
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# Prevents sdist builds → no tar extraction
|
|
PIP_ONLY_BINARY: ":all:"
|
|
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: 3.12
|
|
cache: "pip" # caching pip dependencies
|
|
cache-dependency-path: ./.github/scripts/requirements_pre_commit.txt
|
|
|
|
- name: Run Pre-Commit Hooks
|
|
run: |
|
|
pip install --require-hashes --only-binary=:all: -r ./.github/scripts/requirements_pre_commit.txt
|
|
|
|
- name: Run Pre-Commit
|
|
run: |
|
|
pre-commit run ruff --all-files -c .pre-commit-config.yaml
|
|
pre-commit run ruff-format --all-files -c .pre-commit-config.yaml
|
|
pre-commit run codespell --all-files -c .pre-commit-config.yaml
|
|
pre-commit run gitleaks --all-files -c .pre-commit-config.yaml
|
|
pre-commit run end-of-file-fixer --all-files -c .pre-commit-config.yaml
|
|
pre-commit run trailing-whitespace --all-files -c .pre-commit-config.yaml
|
|
git diff --exit-code
|