chore: Use pre-commit framework (#604)
* Add pre-commit, prettier configs and editorconfig * Remove `check-toml` hook * Add isort config * Add codespell config * Update hooks * Remove prettierignore * Add shellcheck config * Add lint workflow * Add pre-commit autoupdate workflow * Remove path constraints from lint workflow * Fix CI * Add guide to CONTRIBUTING.md * Fix (probably) shfmt * Fix (probably) shfmt * Fix (probably) shfmt
This commit is contained in:
33
.github/workflows/lint.yml
vendored
33
.github/workflows/lint.yml
vendored
@@ -4,19 +4,38 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "*.sh"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "*.sh"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ludeeus/action-shellcheck@1.1.0
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
|
||||
# For shfmt pre-commit hook
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "^1.14"
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pre-commit
|
||||
~/.cache/pip
|
||||
key: lint-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
||||
- name: Install pre-commit
|
||||
run: pip install -U pre-commit
|
||||
|
||||
- name: Lint
|
||||
run: pre-commit run --color=always --all-files
|
||||
env:
|
||||
SHELLCHECK_OPTS: -x
|
||||
GO111MODULE: on
|
||||
|
||||
26
.github/workflows/pre-commit-autoupdate.yml
vendored
Normal file
26
.github/workflows/pre-commit-autoupdate.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Autoupdate pre-commit hooks
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Every day at 7 am
|
||||
- cron: 0 7 * * *
|
||||
|
||||
jobs:
|
||||
pre-commit-autoupdate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Update pre-commit hooks
|
||||
uses: vrslev/pre-commit-autoupdate@v1.0.0
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
branch: pre-commit-autoupdate
|
||||
title: "chore(deps): Update pre-commit hooks"
|
||||
commit-message: "chore(deps): Update pre-commit hooks"
|
||||
body: Update pre-commit hooks
|
||||
labels: dependencies,development
|
||||
delete-branch: True
|
||||
Reference in New Issue
Block a user