GHA CI: add file health checking

Chocobo1 2024-05-01 17:01:59 +08:00
parent d5dcc30e5a
commit 35fe9c3296
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 73 additions and 0 deletions

25
.github/workflows/ci_file_health.yaml vendored Normal file

@ -0,0 +1,25 @@
name: CI - File health
on: [pull_request, push]
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.head_ref != '' }}
jobs:
ci:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install tools
uses: actions/setup-python@v5
with:
python-version: "*"
- name: Check files
uses: pre-commit/action@v3.0.1

@ -0,0 +1,18 @@
# https://github.com/crate-ci/typos/blob/master/docs/reference.md
# https://github.com/crate-ci/typos/blob/master/docs/design.md#identifiers-and-words
# try adding to `identifiers` list first, if doesn't work then `words` list
[default.extend-identifiers]
additionals = "additionals"
caf = "caf"
curren = "curren"
FO = "FO"
ket = "ket"
Q_INVOKABLE = "Q_INVOKABLE"
switchs = "switchs"
ths = "ths"
[default.extend-words]
BA = "BA"
helo = "helo"

30
.pre-commit-config.yaml Normal file

@ -0,0 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.5.0
hooks:
- id: fix-byte-order-marker
name: Check file encoding (UTF-8 without BOM)
- id: mixed-line-ending
name: Check line ending character (LF)
args: ["--fix=lf"]
- id: end-of-file-fixer
name: Check trailing newlines
- id: trailing-whitespace
name: Check trailing whitespaces
- repo: https://github.com/codespell-project/codespell.git
rev: v2.2.6
hooks:
- id: codespell
name: Check spelling (codespell)
args: ["--ignore-words-list", ""]
- repo: https://github.com/crate-ci/typos.git
rev: v1.16.18
hooks:
- id: typos
name: Check spelling (typos)
args: ["--config", ".github/workflows/helper/pre-commit/.typos.toml"]