With the GitHub Checks API, it is possible to add a neutral/failing commit status that includes a button to trigger an arbitrary action.
For example, this might look something like:
Clicking "details" will take you to the checks tab of the PR, which might show something like:
Clicking the button will trigger a check_run.requested_action event. Then this app can respond to the action_requested webhook and trigger a CI run.
I think this is preferable than the label-based approach for a few reasons:
Adding/removing labels creates noise in the PR
Because checks apply to a specific commit, it avoids the current potential race conditions where a user pushes new commits right before a label is added
Having an explicit status check and associated action button is more intuitive than a convention regarding adding/removing labels
If this app used probot, the code might look something like this:
context.github.checks.create(
context.repo({
name: "CI Gate",
head_branch,
head_sha,
status: "completed",
conclusion: "action_required",
completed_at: new Date(),
output: {
title: "CI run not yet authorized",
summary:
"Click the above <kbd>Trigger CI run</kbd> button to trigger a CI run."
},
actions: [
{
label: "Trigger CI run",
description: "Trigger a CI run",
identifier: "trigger_ci"
}
]
})
);
If that sounds good to you, I could probably help implement this.
With the GitHub Checks API, it is possible to add a neutral/failing commit status that includes a button to trigger an arbitrary action.
For example, this might look something like:
Clicking "details" will take you to the checks tab of the PR, which might show something like:
Clicking the button will trigger a
check_run.requested_action
event. Then this app can respond to theaction_requested
webhook and trigger a CI run.I think this is preferable than the label-based approach for a few reasons:
If this app used probot, the code might look something like this:
If that sounds good to you, I could probably help implement this.