Skip to content

Example updates

Example updates #258

Workflow file for this run

---
name: Pre-Commit
on:
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@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up BATS
uses: mig4/setup-bats@af9a00deb21b5d795cabfeaa8d9060410377686d # v1
with:
bats-version: 1.2.1
- 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 renovatebot PRs
run: 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 "action@github.com"
git config --global user.name "GitHub Action"
git add 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