Skip to content

Commit

Permalink
Add pre-commit action workflow
Browse files Browse the repository at this point in the history
This patch adds a GitHub Action workflow to run
[pre-commit](https://pre-commit.com/) to run checks on changed files.

The following checks are active:
 - check-added-large-files: prevent large files from being committed
 - check-case-conflict: checks for files that would conflict in
   case-insensitive filesystems
 - check-toml, check-yaml: check toml/yaml parseability
 - end-of-file-fixer: make sure files end with newline
 - mixed-line-ending: check for mixed line endings
 - trailing-whitespace: no trailing whitespace

To configure `pre-commit` to run locally when committing: i) install
pre-commit and ii) install the hook with `pre-commit install`.
  • Loading branch information
fredrikekre committed May 20, 2024
1 parent 15db94b commit 5921799
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

0 comments on commit 5921799

Please sign in to comment.