GitHub events
GitHub reaches Spotlight through the Spotlight GitHub App. Each delivery is
routed to the workspace that connected the App installation it came from, and
read into happenings. Lines react to happenings with their reactions; see
spotlight_line.
Happenings
| GitHub event | Condition | Happening | Answers |
|---|---|---|---|
pull_request | action opened, reopened or ready_for_review | github.pull_request.opened | no |
pull_request | action labeled, with a label name | github.pull_request.labelled | no |
pull_request | action closed, merged | github.pull_request.merged | no |
pull_request | action closed, not merged | github.pull_request.closed-unmerged | no |
pull_request_review | review state changes_requested | github.pull_request.changes-requested | yes |
pull_request_review | action submitted, any other state | github.pull_request.commented | yes |
issue_comment | action created | github.pull_request.commented | yes |
pull_request_review_comment | action created | github.pull_request.commented | yes |
| any of the four rows above | the comment or review contains @ | also github.pull_request.mentioned | yes |
check_suite | action completed, conclusion failure | github.checks.failed | no |
A happening that answers carries the words of the comment or review as a message, with the file and lines it is about where there are any. Those words can answer a task that awaits review; see Moves.
github.checks.failed carries the failed checks of the suite as a message. The
message starts with their names, as in Failed: web / build, gitleaks. For up to
five checks that Spotlight knows more about, it then gives more:
- For a GitHub Actions job: the step that failed and the last 40 lines of the
job's log, up to 4,000 characters. The log ends at the last
##[error]line, so the clean-up after the failed step is not in it. - For a check from another app: the start of its summary, up to 40 lines and 2,000 characters.
Spotlight reads the logs of the first five failed Actions jobs. It has no
message if GitHub does not give the names. If GitHub does not give a step or a
log in time, the message has the names only. The
checks tool
gives the same failed steps and longer logs, within the limits on that page.
Each happening also has a label and a line of text written to the task's notes when the delivery carries no words:
| Happening | Label | Text |
|---|---|---|
github.pull_request.opened | Pull request opened | A pull request was opened for review. |
github.pull_request.merged | Pull request merged | The pull request was merged. |
github.pull_request.closed-unmerged | Pull request closed unmerged | The pull request was closed without being merged. |
github.pull_request.changes-requested | Changes requested | Changes were requested on the pull request. |
github.pull_request.commented | Pull request commented on | The pull request was commented on. |
github.pull_request.mentioned | Mentioned on a pull request | Somebody mentioned Spotlight on the pull request. |
github.pull_request.labelled | Labelled on a pull request | Somebody labelled the pull request for Spotlight. |
github.checks.failed | Checks failed | The checks failed on the pull request. |
A task with pull requests in several repositories reacts to
github.pull_request.merged and github.pull_request.closed-unmerged only when
the last of them that is still open closes. An earlier close adds a note to the
task, and the task stays where it is. A pull request that is reopened counts as
open again.
An installation delivery with action deleted disconnects the workspace from
GitHub.
Deliveries from bots
A delivery counts as a bot's when its sender, comment author or review author
has GitHub user type Bot. The happenings a bot's delivery raises are dropped,
except github.pull_request.opened, github.pull_request.labelled and
github.checks.failed. Spotlight adds no labels, so a label a bot adds is never
Spotlight's own. A check suite's sender is the account that pushed the commit,
which for a Spotlight branch is the Spotlight App.
Marks
| Mark | Belongs to | Value |
|---|---|---|
git.pull-request | The task that opened the pull request, from the moment it opens. | The pull request's URL. |
github.review | The task that reviews the pull request. | The pull request's URL. |
Both are finding marks. A mark belongs to at most one task in a workspace.
How a happening finds its task
A happening names what it concerns: a branch, marks, or both.
| Concern | Taken from | Finds |
|---|---|---|
| Branch | The pull request's head branch, or the check suite's head branch. | The task whose branch has that name. |
git.pull-request mark | The pull request's URL. | The task that opened the pull request. |
Every happening except opened, mentioned and labelled that names a pull
request is
also sent a second time, concerning the github.review mark of that pull
request. The task that has that mark receives it.
A branch that is not a task's branch finds no task by its name. A delivery that names neither a branch nor a pull request is rejected.
Review tasks
github.pull_request.opened, github.pull_request.mentioned and
github.pull_request.labelled request a review. A labelled happening carries
the label's name, and a line takes it only if that name, without regard to case, is its
review policy's label. Spotlight chooses a line that:
- has role
review; - has no repositories, or names the pull request's repository;
- has a review policy (
reviews) that takes the pull request.
Lines that name the repository come first, then lines in order of key.
If an unfinished task already has the pull request's github.review mark,
that task receives the happening. Otherwise a new task opens on the chosen line:
| Property | Value |
|---|---|
| Station | The line's first work station. |
| Title | The pull request's title. |
| Description | Review <url>, then the pull request's description. |
| Mark | github.review with the pull request's URL. |
A line's review policy (reviews) decides which pull requests it takes. See
Review policy fields.
Built-in tools
The pull-request, checks, review-comment and review tools are described in
Built-in tools and skills.
Installation callback
After the App is installed, GitHub sends the browser to /github/installed on
the Spotlight address, with these query parameters:
| Parameter | Value |
|---|---|
installation_id | The installation's id. |
setup_action | request when an organisation owner still has to approve the App. |
state | The workspace and team the install started from, set by Spotlight. |
The page connects the installation with
POST /api/workspaces/{slug}/github, body {"installationId": "<id>"}.
| Status | When |
|---|---|
204 | Connected. |
403 | Not an owner or admin, or not an admin of the installation. |
409 | The installation is already connected to another workspace. |
One installation connects one workspace. The connection covers every team in the workspace. See GitHub connection for who may connect.