Skip to content

Commit 4f12910

Browse files
authored
RFC: Process Github issue_comment events to support adhoc task creation (#168)
1 parent f765ac3 commit 4f12910

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ See [mechanics](mechanics.md) for more detail.
6161
| RFC#163 | [ProjectId](rfcs/0163-project-id.md) |
6262
| RFC#165 | [Anonymous scopes](rfcs/0165-Anonymous-scopes.md) |
6363
| RFC#166 | [Sign Public S3 URLs](rfcs/0166-Sign-public-S3-urls.md) |
64+
| RFC#168 | [Process Github issue_comment events to support adhoc task creation](rfcs/0168-Trigger-Tests-Based-on-PR-Comments.md) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# RFC 168 - Process Github issue_comment events to support adhoc task creation
2+
* Comments: [#168](https://github.com/taskcluster/taskcluster-rfcs/pull/168)
3+
* Proposed by: @bhearsum
4+
5+
# Summary
6+
7+
Listen, and render `.taskcluster.yml`, for Github `issue_comment` events.
8+
9+
## Motivation
10+
11+
Multiple use cases for triggering tasks in an adhoc manner on Pull Requests have come up recently. Most notably:
12+
* Triggering tasks for PRs opened by a non-collaborator
13+
* Triggering tasks that don't run by default (ie: because they're expensive)
14+
15+
As Taskcluster is used increasingly for high-importance projects on Github (like Fenix), it's important that we're able to support these use cases.
16+
17+
# Details
18+
19+
`.taskcluster.yml` will be modified to support a new `allowComments` policy, which will support `collaborators` as a value. When set, collaborators to the repository may add a comment containing a string beginning with "/taskcluster ", which will cause Taskcluster-Github to render `.taskcluster.yml` with `tasks_for` set to `github-issue-comment`, and a new context variable `event.issue.comment` set to everything appearing after "/taskcluster " in the comment. For example, a comment of "/taskcluster run-tests" will set `event.comment` to `run-tests`. This will allow `.taskcluster.yml` implementers the flexibility to take different actions based on the comment. Some examples:
20+
* A comment of "/taskcluster run-tests" could trigger all Tasks
21+
* A comment of "/taskcluster run-test-foo" could trigger just the `foo` Task
22+
* A comment of "/taskcluster merge" could trigger a Task that merges the PR
23+
24+
To support this, Taskcluster-Github will be modified to watch for [`issue_comment`](https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment) events. When one is received, it will check if:
25+
* The `allowComments` policy is set to `collaborators` in the `.taskcluster.yml` on the default branch
26+
* The `sender` is a valid collaborator
27+
28+
If the above is true, it will process the `.taskcluster.yml` as described above, and create any resulting Tasks.
29+
30+
Because we will be listening for a new event, existing installations that want to make use of this feature will need to re-authorize the Taskcluster integration. New installations will get it by default upon install.
31+
32+
This has been previously discussed in https://github.com/taskcluster/taskcluster-rfcs/issues/95 and https://github.com/taskcluster/taskcluster/issues/40.
33+
34+
# Implementation
35+
36+
* Tracking bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1715848
37+
* RRA (to be scheduled after RFC is Accepted)

rfcs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@
4949
| RFC#163 | [ProjectId](0163-project-id.md) |
5050
| RFC#165 | [Anonymous scopes](0165-Anonymous-scopes.md) |
5151
| RFC#166 | [Sign Public S3 URLs](0166-Sign-public-S3-urls.md) |
52+
| RFC#168 | [Process Github issue_comment events to support adhoc task creation](0168-Trigger-Tests-Based-on-PR-Comments.md) |

0 commit comments

Comments
 (0)