-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create initial
pre-commit
configuration
The commit introduces a basic `pre-commit` configuration with hooks for auto-fixing common code quality issues: * Ensure files end with a newline (`end-of-file-fixer`), * Standardizing line endings to LF (`mixed-line-ending`), and * Removing trailing whitespace (`trailing-whitespace`). Use a home-brewed pre-commit CI action, because the organization cannot install the necessary pre-commit GitHub application. Draw inspiration from: * https://github.com/isaak654/sandboxie-docs/blob/6169c206fa9978641dafddf34303404604beaf33/.pre-commit-config.yaml * https://github.com/isaak654/sandboxie-docs/blob/84751989d8fdee890520f116ea9e2ab0ff9f9b53/.github/workflows/action.yml#L59-L87 Signed-off-by: Stavros Ntentos <[email protected]>
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: pre-commit | ||
|
||
on: | ||
# Triggers the workflow on ALL push or pull request events | ||
# except for the `gh-pages`` branch | ||
push: | ||
branches-ignore: | ||
- gh-pages | ||
pull_request: | ||
branches-ignore: | ||
- gh-pages | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
|
||
- uses: pre-commit/[email protected] | ||
|
||
- name: Commit changes | ||
if: ${{ !cancelled() && failure() }} | ||
shell: bash | ||
run: | | ||
git config --local user.name "pre-commit-ci[bot]" | ||
git config --local user.email "66853113+pre-commit-ci[bot]@users.noreply.github.com" | ||
git commit -m "[pre-commit.ci] auto-fixes from pre-commit hooks" -a | ||
git push origin HEAD:${{ github.head_ref || github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ jobs: | |
ghp-import site --push | ||
- uses: actions/[email protected] | ||
with: | ||
path: './site' | ||
path: './site' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ci: | ||
autofix_commit_msg: '[pre-commit.ci] auto-fixes from pre-commit hooks' | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: | ||
- --maxkb=10000 | ||
- id: check-merge-conflict | ||
- id: mixed-line-ending | ||
args: | ||
- --fix=lf | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: forbid-new-submodules | ||
- id: trailing-whitespace |