12
12
- PullRequestOpened
13
13
types :
14
14
- completed
15
+ env :
16
+ SUPPORTED_COMMANDS : |
17
+ <details>
18
+ <summary> Supported commands </summary>
19
+
20
+ Please post this commands in separate comments and only one per comment:
21
+ * `@github-actions run-benchmark` - Run benchmark comparing base and merge commits for this PR
22
+ * `@github-actions publish-pr-on-npm` - Build package from this PR and publish it on NPM
23
+ </details>
15
24
jobs :
16
25
hello-message :
17
26
if : github.event_name == 'workflow_run'
38
47
`Hi @${event.sender.login}, I'm @github-actions bot happy to help you with this PR 👋\n\n` +
39
48
process.env.SUPPORTED_COMMANDS,
40
49
})
41
- env :
42
- SUPPORTED_COMMANDS : |
43
- <details>
44
- <summary> Supported commands </summary>
45
-
46
- Please post this commands in separate comments and only one per comment:
47
- * `@github-actions run-benchmark` - Run benchmark comparing base and merge commits for this PR
48
- * `@github-actions publish-pr-on-npm` - Build package from this PR and publish it on NPM
49
- </details>
50
50
51
51
accept-cmd :
52
52
if : |
94
94
95
95
respond-to-cmd :
96
96
needs :
97
+ - accept-cmd
97
98
- cmd-publish-pr-on-npm
98
99
- cmd-run-benchmark
99
- if : github.event_name == 'issue_comment ' && always()
100
+ if : needs.accept-cmd.result != 'skipped ' && always()
100
101
runs-on : ubuntu-latest
101
102
steps :
102
103
- uses : actions/github-script@v5
@@ -107,15 +108,17 @@ jobs:
107
108
108
109
let replyMessage;
109
110
let allSkipped = true;
110
- for (const { result, outputs } of Object.values(needs)) {
111
- allSkipped = allSkipped && result === 'skipped';
112
- replyMessage = replyMessage || outputs.replyMessage;
111
+ for (const [ name, job ] of Object.entries(needs)) {
112
+ if (name.startsWith('cmd-')) {
113
+ allSkipped = allSkipped && job.result === 'skipped';
114
+ }
115
+ replyMessage = replyMessage || job.outputs.replyMessage;
113
116
}
114
117
115
118
if (!replyMessage) {
116
119
replyMessage = allSkipped
117
- ? 'Unknown command, please check help message at the top of PR.'
118
- : `Something went wrong, please check logs here:\n ${process.env.RUN_URL}`;
120
+ ? 'Unknown command 😕\n\n' + process.env.SUPPORTED_COMMANDS
121
+ : `Something went wrong, [ please check log]( ${process.env.RUN_URL}). `;
119
122
}
120
123
121
124
const quoteRequest = comment.body
0 commit comments