Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# File is synced from Kong/template-generic and will be overwritten
name: pre-commit

on: # yamllint disable-line rule:truthy
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: install shfmt
run: |
mkdir -p $GITHUB_WORKSPACE/bin
curl -L -s -o $GITHUB_WORKSPACE/bin/shfmt https://github.com/mvdan/sh/releases/download/v3.1.2/shfmt_v3.1.2_linux_amd64
chmod +x $GITHUB_WORKSPACE/bin/shfmt
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: pre-commit github auth
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git version
git config --global url."https://${TOKEN}:x-oauth-basic@github.com/".insteadOf "git@github.com:"
- uses: pre-commit/action@v3.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
extra_args: --from-ref origin/${{ github.base_ref }} --to-ref ${{github.event.pull_request.head.sha}}
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
# File is synced from Kong/template-generic and will be overwritten
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -17,7 +16,7 @@ repos:
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.10
rev: v1.5.4
hooks:
- id: forbid-crlf
- id: remove-crlf
Expand All @@ -34,7 +33,7 @@ repos:
- id: yamlfmt
args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '150']
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.1
rev: v1.32.0
hooks:
- id: yamllint
args: [--format, parsable, --strict]