Skip to content

Auto go generate for pull request #1

Auto go generate for pull request

Auto go generate for pull request #1

Workflow file for this run

name: Go Generate and Commit
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
jobs:
build:
if: "!contains(github.event.head_commit.message, 'Generate files')"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20.x'
- name: Run go generate
run: |
go generate ./...
- name: Commit and push if changed
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git diff --quiet || (git add -A && git commit -m "Generate files" && git push)