Update gofmt.yml #3
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: auto-format | ||
on: workflow_dispatch | ||
jobs: | ||
format: | ||
# Check if the PR is not from a fork | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: gofmt | ||
run: gofmt -s -w . | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | ||
- name: Push changes | ||
if: steps.git-check.outputs.modified == 'true' | ||
- uses: EndBug/add-and-commit@v9 | ||
with: | ||
author_name: micah teeuws | ||
author_email: [email protected] | ||
message: 'format go files' |