Bumped to 1.23 #1216
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Pre-Commit | |
on: | |
push: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
# 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python | |
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 | |
with: | |
python-version: "3.x" | |
- name: Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5 | |
with: | |
go-version: "1.22.3" | |
- 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: python3 -m pip install pre-commit | |
- name: Run go mod tidy - necessary to avoid errors with renovatebot PRs | |
run: go mod tidy | |
- 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 | |
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 |