fix file name #221
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: Run pre-commit checks | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
run-pre-commit: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go environment | |
uses: actions/[email protected] | |
with: | |
go-version-file: "go.mod" | |
- name: Install Pre-Commit | |
run: pip install pre-commit | |
- name: Install dependencies | |
run: | | |
# install required go packages | |
go mod tidy | |
# install gofumpt | |
go install mvdan.cc/gofumpt@latest | |
# install golangci-lint | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | |
- name: Autoupdate hooks | |
run: pre-commit autoupdate | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
env: | |
SKIP: "no-commit-to-branch" # if not skipped, will always fail on main | |
- name: Push changes | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "No changes were made" | |
exit 0 | |
fi | |
echo "Found changes" | |
git commit -m "chore: automatically push pre-commit changes" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: always() |