diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..3b9b9c1 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -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}} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3087b7f..616af83 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 @@ -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]