forked from ent/contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
42 lines (42 loc) · 1.26 KB
/
action.yaml
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
38
39
40
41
42
name: entci
description: Continuous integration for Ent projects
inputs:
tidy:
description: Run go mod tidy after generate
required: false
default: ""
working-directory:
default: "."
required: false
description: Where to run commands
runs:
using: "composite"
steps:
- name: Verify Generated
uses: actions/github-script@v6
with:
script: |
if ( "${{ inputs.working-directory }}" != "") {
process.chdir("${{inputs.working-directory}}");
}
core.info('checking generated files are checked in.')
await exec.exec('go generate ./...');
if( "${{inputs.tidy}}" != "") {
core.info('running go mod tidy.')
await exec.exec('go mod tidy');
}
let out = '';
let listen = (data) => { out += data.toString() }
let options = {
listeners: {
stdout: listen,
stderr: listen,
}
};
await exec.exec('git', ['status', '--porcelain'], options)
if (out.length > 0) {
core.info(out)
core.setFailed('Generated code not checked in. Run go generate ./...')
return
}
core.info('Generated code checked-in.');