Replace nix shell with devbox #71
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: Formatter | |
on: | |
pull_request: | |
types: [opened] | |
issue_comment: | |
types: [created] | |
jobs: | |
format: | |
name: "Format" | |
runs-on: ubuntu-22.04 | |
if: github.event.issue.pull_request | |
steps: | |
- uses: khan/[email protected] | |
id: check | |
with: | |
trigger: '/format' | |
reaction: "+1" # Reaction must be one of the reactions here: https://developer.github.com/v3/reactions/#reaction-types | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
- name: Check out PR | |
if: steps.check.outputs.triggered == 'true' | |
run: gh pr checkout ${{ github.event.issue.number }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: true | |
- name: Format Go Code | |
if: steps.check.outputs.triggered == 'true' | |
run: go fmt . | |
- name: Commit changes | |
if: steps.check.outputs.triggered == 'true' | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git status | |
git diff --stat | |
git commit -am "chore: format code" | |
git log --oneline --max-count=10 | |
git push | |
- uses: khan/[email protected] | |
if: failure() | |
with: | |
trigger: '/format' | |
reaction: "confused" # Reaction must be one of the reactions here: https://developer.github.com/v3/reactions/#reaction-types | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |