RFC: Try out running pre-made pre-commit hooks via github actions

This commit is contained in:
Paul Bartell 2021-03-05 15:16:36 -08:00
parent de19eeb7d3
commit 0f165d5d28
4 changed files with 37 additions and 4 deletions

View file

@ -12,6 +12,7 @@ KERNEL_IGNORED_FILES = [
KERNEL_IGNORED_EXTENSIONS = [
'.yml',
'.yaml',
'.css',
'.idx',
'.md',
@ -92,4 +93,3 @@ def main():
if __name__ == '__main__':
exit(main())

View file

@ -1,7 +1,5 @@
name: CI Checks
on:
push:
branches: ["**"]
pull_request:
branches: [main]
workflow_dispatch:
@ -44,4 +42,3 @@ jobs:
- name: URL Checker
run: |
bash kernel/.github/actions/url_verifier.sh kernel

18
.github/workflows/pre-commit.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Linters
on:
pull_request:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- id: file_changes
uses: trilom/file-changes-action@v1.2.4
with:
output: ' '
- uses: pre-commit/action@v2.0.0
with:
extra_args: --files ${{ steps.file_changes.outputs.files}}

18
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,18 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: mixed-line-ending
args : [--fix=auto]
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-ast