either to check it produces no diff, or to manually trigger pushing any diff as a commmit to the current branch.
35 lines
979 B
YAML
35 lines
979 B
YAML
name: go-generate-check
|
|
on:
|
|
push:
|
|
branches: ['main']
|
|
paths:
|
|
- '**.go'
|
|
- '**.mod'
|
|
- '**.sum'
|
|
pull_request:
|
|
paths:
|
|
- '**.go'
|
|
- '**.mod'
|
|
- '**.sum'
|
|
workflow_dispatch:
|
|
jobs:
|
|
go-generate-check:
|
|
name: go-generate-check
|
|
container:
|
|
image: registry.opensuse.org/devel/factory/git-workflow/containers/opensuse/bci/golang-extended:latest
|
|
steps:
|
|
- run: git clone --no-checkout --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }} .
|
|
- run: git fetch origin ${{ gitea.ref }}
|
|
- run: git checkout FETCH_HEAD
|
|
- run: go generate -C common
|
|
- run: go generate -C workflow-pr
|
|
- run: go generate -C workflow-pr/interfaces
|
|
- run: git add -N .; git diff
|
|
- run: |
|
|
status=$(git status --short)
|
|
if [[ -n "$status" ]]; then
|
|
echo -e "$status"
|
|
echo "Please commit the differences from running: go generate"
|
|
false
|
|
fi
|