skirl

GitHub

A repository's (or an organisation's) pushes, pull requests, issues, comments, releases and workflow runs arrive as short messages, each linking to the thing itself. A workflow that passes after failing replaces the failure, so the topic shows each workflow's latest result.

Setting it up#

In the app these steps are under Connect a system → GitHub, or a topic's Send to this topic tab, with the address, topic and a token filled in; New token makes the token.

A repository (or organisation) webhook. It cannot send a token header, so the token is in the URL: keep the URL as secret as the token.

  1. Settings → Webhooks → Add webhook:

    • Payload URL: https://notify.example.com/github?template=github&auth=QmVhcmVyIHRrX3JlcGxhY2Vfd2l0aF95b3VyX3Rva2Vu
    • Content type: application/json
    • Secret: leave empty
  2. Which events would you like to trigger this webhook? Let me select individual events, then tick:

    • Events: Pushes, Pull requests, Issues, Issue comments, Releases, Workflow runs
  3. Optional: tick Stars too, after ticking New star under Events to send above. Without New star, Skirl drops them.

  4. Add webhook. GitHub sends a ping, which arrives as "GitHub webhook connected".

The steps here show example values (https://notify.example.com, the topic github): copy them from the app, where yours are filled in.

  • GitHub cannot send a header with a token, so the token is in the Payload URL, after &auth=. Treat the whole address as a secret. After New token or Rotate, copy the whole address into GitHub again.
  • The events you tick in Skirl are in the address too (&events=…). GitHub's own event list says what GitHub sends; Skirl's says what it keeps. The steps list GitHub's boxes for the events Skirl keeps: tick New star in Skirl and Stars joins the list (until then it is under Optional), since Skirl drops stars until New star is ticked.
  • Skirl answers every delivery it takes with 200, also the ones it drops, so GitHub never shows them as failed.
  • GitHub must be able to reach your server: github.com cannot reach an address that only works at home.

Skirl's tests replay GitHub's own example deliveries against these steps; GitHub itself cannot be run in a test.

Events#

Event On at first What it means
Webhook connected (GitHub's test) Yes GitHub's ping when the webhook is added: "GitHub webhook connected", at priority 2.
Pushes Yes Commits pushed: who, how many, the branch, and the first five commits. A push that deletes a branch or tag, or has no commits, is not sent.
Pull request opened or reopened Yes The branches, the author and the description.
Pull request ready for review Yes A draft marked ready for review.
Pull request merged Yes A pull request merged.
Pull request closed without merge Yes A pull request closed and not merged.
Issue opened or reopened Yes Who opened it, and its text.
Issue closed Yes Who closed it.
Comments on issues and pull requests Yes A new comment; edited and deleted comments are not sent.
Release published Yes The release and its notes.
CI failed Yes A workflow run that failed, timed out or could not start, at priority 4.
CI passed Yes A workflow run that passed, at priority 2.
CI cancelled No A workflow run that was cancelled, at priority 2.
New star No Someone starred the repository, at priority 2.

The three CI results of one workflow on one branch replace each other: the message shows the latest. Anything else GitHub sends (a pull request updated with new commits, a label added, a fork) is dropped.

What a message looks like#

A push, from GitHub's own example delivery:

Codertocat pushed 3 commits to master · Codertocat/Hello-World
6113728 Initial commit
8f1c2d3 Fix the typo in the README
1a2b3c4 Add a CONTRIBUTING file

Priority 3 · Tags: arrow_up, Hello-World

A failed workflow run:

test failed on master · octo-org/octo-repo
Run #163, started by Codertocat. build(test): check workflow run event payload

Priority 4 · Tags: x, octo-repo

Tapping a message opens what it is about: the comparison of a push, the pull request, the issue, the comment, the release or the workflow run. The first tag shows as an emoji (⬆️ for a push, ❌ for a failure); the second is the repository's name.

When nothing arrives#

  1. Look at the webhook's deliveries on GitHub. GitHub keeps each delivery with Skirl's answer, and can send one again.
  2. The answer is 200 with "dropped":true. Skirl took it and dropped it on purpose: the event is not ticked in Skirl, or it is one Skirl does not send (see above). The answer names the event.
  3. The answer is 401. The token in the address is wrong, rotated or revoked: copy the Payload URL again after New token.
  4. The answer is 400, "message body must be JSON". Content type is not application/json.
  5. There is no answer. GitHub cannot reach your server: A sender gets no message through.

To see whether Skirl takes GitHub's messages at all, send it a ping yourself, from any machine, with the token from the app:

curl -fsS -H "Authorization: Bearer tk_replace_with_your_token" -H "X-GitHub-Event: ping" -H "Content-Type: application/json" -d '{"zen":"Keep it logically awesome.","repository":{"full_name":"example/app","name":"app"}}' "https://notify.example.com/github?template=github"

It arrives in the topic as "GitHub webhook connected · example/app".

This page on GitHub