Skip to content

chore(deps): update pre-commit hook pre-commit/pre-commit-hooks to v4… #699

chore(deps): update pre-commit hook pre-commit/pre-commit-hooks to v4…

chore(deps): update pre-commit hook pre-commit/pre-commit-hooks to v4… #699

Workflow file for this run

---
name: Pre-Commit
on:
push:
pull_request:
# Run once a week (see https://crontab.guru)
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
pre-commit:
name: Update pre-commit hooks and run pre-commit
runs-on: ubuntu-latest
steps:
- name: Set up git repository
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: "3.x"
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4
with:
go-version: "1.21.0"
- name: Install go module dependencies
run: |
go install mvdan.cc/sh/v3/cmd/shfmt@latest
go install github.com/magefile/mage@latest
- name: Install pre-commit
run: pip3 install pre-commit
- name: Run go mod tidy - necessary to avoid errors with renovate PRs
run: |
go mod tidy
pushd magefiles; go mod tidy; popd
- name: Commit go.mod and go.sum changes to keep pre-commit happy
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add go.mod go.sum magefiles/go.mod magefiles/go.sum
git diff --quiet && git diff --staged --quiet || \
git commit -m "Update go.mod and go.sum"
- name: Install pre-commit dependencies
run: mage installDeps
- name: Run pre-commit
run: mage runPreCommit