Extensions
Extensions
github
Extensions
extensions/github.md

github

GitHub from the back end: REST page by page, GraphQL through graphql, a GitHub App's tokens, and webhooks checked and done once. The whole of it is docs/github.md.

text
use "pkg:github/webhooks.mote" // takes github.mote
use "pkg:github/app.mote" // a GitHub App: "installation:<id>" as a token
let i = githubIssueCreate("acme/shop", {title: "Lamp flickers", labels: ["bug"]}, "")?
let f = githubFile("acme/shop", "README.md", "", "")?
githubFilePut("acme/shop", "README.md", bytes(f.text + "More.\n"), {message: "More", sha: f.sha}, "")?
fn githubPushed(p: GithubPush): bool // the program's hook

Settings: GITHUB_TOKEN, GITHUB_APP_KEY, GITHUB_WEBHOOK_SECRET (secrets); GITHUB_APP_ID, GITHUB_API, GITHUB_GRAPHQL, GITHUB_WAIT, GITHUB_AGENT. The program's mote.toml names graphql beside github.

File
github.moteThe calls, the shapes, the limits, GraphQL.
app.moteThe App's JWT (crypto.jwt.sign, RS256, its PKCS #1 key as GitHub gives it), installation tokens kept sealed.
webhooks.motePOST /github/webhook: X-Hub-Signature-256, each delivery once, the hooks in a job.
tests.moteIts tests, GitHub's published signature example among them (tests/svc_code/unit.mote).

Covered: repositories (one, a person's, an organisation's, an installation's); contents read (base64, or raw over a megabyte), written with the sha, deleted, folders; issues listed, got, made, changed, labelled; comments; pull requests listed, made, their files, reviews, merged; check runs made, changed, listed; commit statuses; releases made (notes by GitHub), listed, the latest, assets uploaded; workflows dispatched, repository dispatches, runs listed; GraphQL with paging; the App's JWT, installation tokens kept in the database until near their end, the installation of a repository, every installation; limits primary and secondary held per token and waited out within GITHUB_WAIT; webhooks: push, issues, pull_request, issue_comment, installation, and every event.

Left out on purpose: the OAuth flows (the oauth extension's), git's own data, search, projects (GraphQL), packages, deployments, Actions secrets, gists, paced writes ahead of a limit.

Not yet run against GitHub: only against a stand-in (tests/all.sh real_svc_code).

Edit this page:extensions/github/README.md
On this page
esc
1072 sections of 111 pages, ranked as you type.A heading's words count for more than what stands under it.
↑↓move
↵open
ranked by BM25, in the page