9
9
git
10
10
jira
11
11
12
+ issue_commands_list : |
13
+ jira
14
+
12
15
jobs :
13
16
slashCommandDispatch :
14
17
if : startsWith(github.event.comment.body, '/')
@@ -22,25 +25,42 @@ jobs:
22
25
uses : actions/github-script@v7
23
26
env :
24
27
COMMANDS_LIST : ${{ env.commands_list }}
28
+ ISSUE_COMMANDS_LIST : ${{ env.issue_commands_list }}
25
29
with :
26
30
github-token : ${{ secrets.GIT_PAT }}
27
31
script : |
28
32
const body = context.payload.comment.body.toLowerCase().trim()
29
33
const commands_list = process.env.COMMANDS_LIST.split("\n")
34
+ const issue_commands_list = process.env.ISSUE_COMMANDS_LIST.split("\n")
30
35
console.log("Detected PR comment: " + body)
31
36
console.log("Commands list: " + commands_list)
37
+ console.log("Issue commands list: " + issue_commands_list)
32
38
commandArray = body.split(/\s+/)
33
39
const contextCommand = commandArray[0].split('/')[1].trim();
34
40
console.log("contextCommand: " + contextCommand)
35
41
core.setOutput('command_state', 'known')
42
+ core.setOutput('is_issue_command', 'false')
36
43
if (! commands_list.includes(contextCommand)) {
37
44
core.setOutput('command_state', 'unknown')
38
45
core.setOutput('command', contextCommand)
39
46
}
47
+ if (issue_commands_list.includes(contextCommand)) {
48
+ core.setOutput('is_issue_command', 'true')
49
+ }
50
+
51
+ - name : Slash Command Dispatch for Issues
52
+ id : scd_issues
53
+ if : ${{ steps.determine_command.outputs.command_state != 'unknown' && steps.determine_command.outputs.is_issue_command == 'true' }}
54
+ uses : peter-evans/slash-command-dispatch@v3
55
+ with :
56
+ token : ${{ secrets.GIT_PAT }}
57
+ issue-type : " issue"
58
+ reactions : true
59
+ commands : ${{ env.issue_commands_list }}
40
60
41
- - name : Slash Command Dispatch
42
- id : scd
43
- if : ${{ steps.determine_command.outputs.command_state != 'unknown' }}
61
+ - name : Slash Command Dispatch for PRs
62
+ id : scd_prs
63
+ if : ${{ steps.determine_command.outputs.command_state != 'unknown' && steps.determine_command.outputs.is_issue_command != 'true' }}
44
64
uses : peter-evans/slash-command-dispatch@v3
45
65
with :
46
66
token : ${{ secrets.GIT_PAT }}
54
74
with :
55
75
comment-id : ${{ github.event.comment.id }}
56
76
body : |
57
- > '/${{ steps.determine_command.outputs.command }}' is unknown command.
77
+ > '/${{ steps.determine_command.outputs.command }}' is an unknown command.
58
78
> See '/help'
59
79
reactions : eyes, confused
0 commit comments