Skip to content

Update Workflow Dependencies and Logging Configuration Improvements #1960

Update Workflow Dependencies and Logging Configuration Improvements

Update Workflow Dependencies and Logging Configuration Improvements #1960

Workflow file for this run

---
name: Pre-Commit
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
push:
branches:
- main
schedule:
# Run once a week (see https://crontab.guru)
- 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: "3.x"
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version: '1.23'
- 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: 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