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.
use "pkg:github/webhooks.mote" // takes github.moteuse "pkg:github/app.mote" // a GitHub App: "installation:<id>" as a tokenlet 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 hookSettings: 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.mote | The calls, the shapes, the limits, GraphQL. |
app.mote | The App's JWT (crypto.jwt.sign, RS256, its PKCS #1 key as GitHub gives it), installation tokens kept sealed. |
webhooks.mote | POST /github/webhook: X-Hub-Signature-256, each delivery once, the hooks in a job. |
tests.mote | Its 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).
extensions/github/README.md