You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`command`|:white_check_mark:| n/a | The name of the command to be used in IssueOps, which can be specified as a comma-separated list.|
174
+
|`allowed_contexts`||`issue,pull_request,discussion`| The comment contexts that trigger the IssueOps command, specified as a comma-separated list. Allowed values: `"issue"`, `"pull_request"`, `"discussion"`.|
171
175
172
176
<!-- gha-inputs-end -->
173
177
@@ -182,8 +186,8 @@ Supports null in JSON format.
182
186
|`comment_id`| The ID of the comment that triggered this action. |
183
187
|`actor`| The GitHub handle of the actor who executed the IssueOps command. |
184
188
|`issue_number`|[Deprecated] The issue number of the comment that triggered this action. Use `number` instead. This output will be removed in the next major release. |
185
-
|`number`| The number of the issue or pull requestthat triggered this action.|
186
-
|`context`| The context that triggered this action. One of `"issue"` or `"pull_request"`. |
189
+
|`number`| The number of the issue, pull request, or discussion that triggered this action. |
190
+
|`context`| The context that triggered this action. One of `"issue"`, `"pull_request"`, or `"discussion"`.|
187
191
|`command`| The command of the triggered IssueOps command. |
188
192
189
193
<!-- gha-outputs-end -->
@@ -192,6 +196,40 @@ Supports null in JSON format.
192
196
193
197
A section introducing tips for implementing IssueOps commands.
194
198
199
+
### Triggering from GitHub Discussions
200
+
201
+
`command-action` also handles GitHub Discussions when the workflow is triggered by the `discussion_comment` event. The same parsing logic applies — the only differences are that `outputs.context` becomes `"discussion"` and `outputs.issue_number` is not emitted (use `outputs.number` instead).
202
+
203
+
```yaml
204
+
name: 'Greet DEMO (Discussions)'
205
+
206
+
on:
207
+
discussion_comment:
208
+
types: [created]
209
+
210
+
permissions:
211
+
contents: read
212
+
discussions: write # only required if your follow-up step writes back to the discussion (e.g. reactions via GraphQL)
> Discussion / Issue / PR comments are attacker-controlled. Pass IssueOps params via `env:` and reference them as shell variables (`"$NAME"`) instead of interpolating `${{ ... }}` directly into a `run:` script. See [GitHub Actions security hardening](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable) for details.
230
+
231
+
To restrict the action to discussions only (or to issues / pull requests only), use the [`allowed_contexts`](#inbox_tray-inputs) input — for example `allowed_contexts: 'discussion'`.
232
+
195
233
### Reacting to the comment
196
234
197
235
You can use [actions/github-script](https://github.com/actions/github-script) to add a reaction to the comment that triggered the IssueOps command.
Copy file name to clipboardExpand all lines: action.yaml
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,8 @@ inputs:
10
10
description: 'The name of the command to be used in IssueOps, which can be specified as a comma-separated list.'
11
11
required: true
12
12
allowed_contexts:
13
-
description: 'The comment contexts that trigger the IssueOps command, specified as a comma-separated list.'
14
-
default: 'issue,pull_request'
13
+
description: 'The comment contexts that trigger the IssueOps command, specified as a comma-separated list. Allowed values: `"issue"`, `"pull_request"`, `"discussion"`.'
14
+
default: 'issue,pull_request,discussion'
15
15
16
16
outputs:
17
17
continue:
@@ -25,9 +25,9 @@ outputs:
25
25
issue_number:
26
26
description: '[Deprecated] The issue number of the comment that triggered this action. Use `number` instead. This output will be removed in the next major release.'
27
27
number:
28
-
description: 'The number of the issue or pull request that triggered this action.'
28
+
description: 'The number of the issue, pull request, or discussion that triggered this action.'
29
29
context:
30
-
description: 'The context that triggered this action. One of `"issue"`or `"pull_request"`.'
30
+
description: 'The context that triggered this action. One of `"issue"`, `"pull_request"`, or `"discussion"`.'
31
31
command:
32
32
description: 'The command of the triggered IssueOps command.'
0 commit comments