-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
38 lines (37 loc) · 1.05 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Validate Go Generate
description: Validate Go Generate
inputs:
root_path:
description: application root path
default: ./
generated-by:
description: Target only the code generated by the specified generator
default: '.*'
commit:
description: commit
default: 'false'
commit-message:
description: commit message
default: 'fix: generate files'
commit-actor:
description: commit actor
default: 'github_actions'
runs:
using: composite
steps:
- name: Remove generated files
run: git grep --name-only -E '^// Code generated by ${{ inputs.generated-by }}. DO NOT EDIT.$' | xargs rm -rf -
shell: bash
- name: Generate files
run: go generate ./...
shell: bash
- if: inputs.commit == 'true'
uses: EndBug/add-and-commit@v9
with:
message: ${{ inputs.commit-message }}
default_author: ${{ inputs.commit-actor }}
push: true
- if: inputs.commit == 'false'
name: Check diff
run: git add . && git diff HEAD --name-only --exit-code
shell: bash