OfficialProductivity

GitHub

Browse and search repositories, code, commits and branches; read files, diffs and CI results; follow issues, pull requests, reviews, releases, workflow runs and gists across your personal account and organizations; and catch up on recent activity and starred repositories.

Each connection sets one access level per area:

Access Read Write
Code and releases Files, branches, commits, compare, archives, releases and their assets, code and commit search Commit and delete files, git blobs, trees, commits and refs, merge and rename branches, sync forks, comment on commits, manage releases
Issues and pull requests Issues, pull requests, comments, reviews, labels, milestones, assignees and collaborators, issue search Open, edit, close, comment, react, label, assign and review
Actions, checks and statuses Workflows, runs, jobs, logs, artifacts, check runs and suites, commit statuses Dispatch, cancel and rerun workflows; set commit statuses
Gists Gists and their files Create, edit and delete gists
Stars Starred repositories Star and unstar
Organizations and teams Your organizations, their members and teams
Email addresses Your email addresses, including private ones
Create and fork repositories Create repositories and forks

New connections read code, issues and pull requests, Actions and organizations. Pull request files, commits and diffs, the pull requests of a commit, and activity feeds also need Code read; merging a pull request or updating its branch needs Write on both Code and Issues and pull requests. Code write includes workflow files wherever GitHub grants the Workflows permission. Profiles, repository lists and metadata, and repository and user search are always available.

GitHub's own permissions still apply: Houston only reaches repositories your account, token or app installation can access.

Connect by signing in with GitHub, or with a personal access token. Archives, gist files, release assets and workflow logs are saved as session files. Repository deletion, settings, secrets, webhooks and administration are not available.

Setup instructions

Connect GitHub

  1. Choose a level for each access row and select Continue with GitHub.
  2. Authorize OK Houston, then install or configure the app for the account/organization and repositories to share. An organization owner may need to approve it.

With Connect with GitHub, Houston enforces the access rows. GitHub's screen lists the app's full permissions, which are the most any connection can reach; the rows you choose narrow them for this connection.

Access is also limited by your own GitHub permissions and the app's installations. Change shared repositories under Installed GitHub Apps without reconnecting.

Advanced

Personal access token

Choose Personal access token in Houston, set the access rows, and follow Create a token on GitHub. The link opens a fine-grained token with the matching permissions filled in, so GitHub enforces them too:

Houston access GitHub permission
Code and releases Contents
Issues and pull requests Issues, Pull requests
Actions, checks and statuses Actions, Commit statuses
Gists Gists, which GitHub offers only as write: add it yourself for Gists Write
Stars Starring
Organizations and teams Members
Email addresses Email addresses
Create and fork repositories Administration

Select the token's owner and repositories before generating it. Metadata is automatic. A token belongs to one owner: a token you own cannot hold Members, and one an organization owns cannot hold Gists, Starring or Email addresses, so use one connection per owner. Code write includes workflow files only when you also grant Workflows. Creating repositories also needs GitHub's Repository creation permission. Check runs and suites need Connect with GitHub or a classic token.

A classic token instead needs repo, workflow, read:org, gist and user:email. It covers all your repositories and repo permits writes; Houston still enforces the access rows.

Missing repositories or access

Check installation/token repository selection, organization approval and SAML SSO (Configure SSO on the token). Replace expired/revoked tokens or reconnect a revoked app. Revoke app access in Authorized GitHub Apps.

Files

  • connector.luau
    -- GitHub REST API, version 2026-03-10. Arguments and results keep GitHub's native field names.
    type Options = {[string]: any}
    type Endpoint = {method: string, path: string, access: string?, query: {string}?, required: {string}?, body: boolean?, save: string?,
    	diff: boolean?, upload: ("contents" | "blob")?, auth: string?, about: string}
    
    local API = "https://api.github.com"
    local VERSION = "2026-03-10"
    local JSON = "application/vnd.github+json"
    
    -- Operations of GitHub's REST OpenAPI description, checked on 2026-10-26. Path {fields} are
    -- required; listed query fields are taken from the options and the other fields form the JSON
    -- body of POST, PATCH and PUT requests (and of DELETE requests marked body; a PUT marked
    -- body = false sends none). access names the access rows a record needs; records without it
    -- are available at every level.
    local endpoints: {[string]: Endpoint} = {
    	getAuthenticatedUser = {method = "GET", path = "/user", about = "The connected account."},
    	getUser = {method = "GET", path = "/users/{username}", about = "A user or organization profile."},
    	listEmails = {method = "GET", path = "/user/emails", access = "emails:read", query = {"per_page", "page"}, about = "Your email addresses, including private ones."},
    	getRateLimit = {method = "GET", path = "/rate_limit", about = "Remaining quota per resource (core, search, graphql...); reading it costs none."},
    	listInstallations = {method = "GET", path = "/user/installations", query = {"per_page", "page"}, auth = "oauth",
    		about = "Where Houston's app is installed, {total_count, installations}."},
    	listInstallationRepos = {method = "GET", path = "/user/installations/{installation_id}/repositories", query = {"per_page", "page"}, auth = "oauth",
    		about = "{total_count, repositories} you can access in one installation."},
    	listMyOrgs = {method = "GET", path = "/user/orgs", access = "organizations:read", query = {"per_page", "page"}, about = "Organizations you belong to."},
    	getOrg = {method = "GET", path = "/orgs/{org}", access = "organizations:read", about = ""},
    	listOrgMembers = {method = "GET", path = "/orgs/{org}/members", access = "organizations:read", query = {"filter", "role", "per_page", "page"}, about = "role: all, admin or member."},
    	listOrgTeams = {method = "GET", path = "/orgs/{org}/teams", access = "organizations:read", query = {"team_type", "per_page", "page"}, about = ""},
    	listTeamMembers = {method = "GET", path = "/orgs/{org}/teams/{team_slug}/members", access = "organizations:read", query = {"role", "per_page", "page"}, about = ""},
    	listUserEvents = {method = "GET", path = "/users/{username}/events", access = "code:read conversations:read", query = {"per_page", "page"},
    		about = "A user's activity, newest first; your own includes private events. Events cover the last 30 days, at most 300."},
    	listReceivedEvents = {method = "GET", path = "/users/{username}/received_events", access = "code:read conversations:read", query = {"per_page", "page"},
    		about = "Activity of the repositories and people a user watches or follows, as listUserEvents."},
    	listMyStarred = {method = "GET", path = "/user/starred", access = "stars:read", query = {"sort", "direction", "per_page", "page"},
    		about = "Repositories you starred. sort: created or updated."},
    	listUserStarred = {method = "GET", path = "/users/{username}/starred", access = "stars:read", query = {"sort", "direction", "per_page", "page"}, about = ""},
    	starRepo = {method = "PUT", path = "/user/starred/{owner}/{repo}", access = "stars:write", body = false, about = ""},
    	unstarRepo = {method = "DELETE", path = "/user/starred/{owner}/{repo}", access = "stars:write", about = ""},
    
    	listMyRepos = {method = "GET", path = "/user/repos", query = {"visibility", "affiliation", "type", "sort", "direction", "per_page", "page", "since", "before"},
    		about = "Repositories you can access. affiliation: owner,collaborator,organization_member."},
    	listUserRepos = {method = "GET", path = "/users/{username}/repos", query = {"type", "sort", "direction", "per_page", "page"}, about = "A user's public repositories."},
    	listOrgRepos = {method = "GET", path = "/orgs/{org}/repos", query = {"type", "sort", "direction", "per_page", "page"}, about = ""},
    	getRepo = {method = "GET", path = "/repos/{owner}/{repo}", about = "A repository, including default_branch and permissions."},
    	createRepo = {method = "POST", path = "/user/repos", access = "repositories:write", required = {"name"}, about = "Body {name, description?, private?, auto_init?, ...}."},
    	createOrgRepo = {method = "POST", path = "/orgs/{org}/repos", access = "repositories:write", required = {"name"}, about = "Body {name, description?, visibility?, auto_init?, ...}."},
    	createFork = {method = "POST", path = "/repos/{owner}/{repo}/forks", access = "repositories:write", about = "Body {organization?, name?, default_branch_only?}. Forking is asynchronous."},
    	listForks = {method = "GET", path = "/repos/{owner}/{repo}/forks", query = {"sort", "per_page", "page"}, about = ""},
    	listLanguages = {method = "GET", path = "/repos/{owner}/{repo}/languages", about = "Bytes of code per language."},
    	getTopics = {method = "GET", path = "/repos/{owner}/{repo}/topics", query = {"per_page", "page"}, about = "{names}."},
    	listRepoEvents = {method = "GET", path = "/repos/{owner}/{repo}/events", access = "code:read conversations:read", query = {"per_page", "page"},
    		about = "Pushes, pull requests, issues, releases and other activity, as listUserEvents."},
    	listStargazers = {method = "GET", path = "/repos/{owner}/{repo}/stargazers", query = {"per_page", "page"}, about = ""},
    	listContributors = {method = "GET", path = "/repos/{owner}/{repo}/contributors", query = {"anon", "per_page", "page"}, about = "Contributors by commit count."},
    	listTags = {method = "GET", path = "/repos/{owner}/{repo}/tags", access = "code:read", query = {"per_page", "page"}, about = "Tags with their commit SHAs."},
    	listCollaborators = {method = "GET", path = "/repos/{owner}/{repo}/collaborators", access = "conversations:read", query = {"affiliation", "permission", "per_page", "page"},
    		about = "Collaborators; needs push access."},
    
    	getReadme = {method = "GET", path = "/repos/{owner}/{repo}/readme", access = "code:read", query = {"ref"}, about = "The README, base64 in content."},
    	getContent = {method = "GET", path = "/repos/{owner}/{repo}/contents/{path}", access = "code:read", query = {"ref"}, save = "application/vnd.github.raw+json",
    		about = "A directory listing, or a file with base64 content up to 1 MB. save_as saves raw bytes (up to 100 MB). List the root with getTree."},
    	putFile = {method = "PUT", path = "/repos/{owner}/{repo}/contents/{path}", access = "code:write", required = {"message", "content"}, upload = "contents",
    		about = "Body {message, content (base64), sha (required to replace a file), branch?, committer?}. Commits one file; content_path='name' streams a session file instead of content."},
    	deleteFile = {method = "DELETE", path = "/repos/{owner}/{repo}/contents/{path}", access = "code:write", required = {"message", "sha"}, body = true,
    		about = "Body {message, sha, branch?}. Commits the deletion."},
    	downloadTarball = {method = "GET", path = "/repos/{owner}/{repo}/tarball/{ref}", access = "code:read", required = {"save_as"}, save = JSON, about = "Saves a .tar.gz archive of ref."},
    	downloadZipball = {method = "GET", path = "/repos/{owner}/{repo}/zipball/{ref}", access = "code:read", required = {"save_as"}, save = JSON, about = "Saves a .zip archive of ref."},
    
    	listBranches = {method = "GET", path = "/repos/{owner}/{repo}/branches", access = "code:read", query = {"protected", "per_page", "page"}, about = "Branches with head SHAs."},
    	getBranch = {method = "GET", path = "/repos/{owner}/{repo}/branches/{branch}", access = "code:read", about = "A branch and its head commit."},
    	renameBranch = {method = "POST", path = "/repos/{owner}/{repo}/branches/{branch}/rename", access = "code:write", required = {"new_name"}, about = "Body {new_name}. Updates open pull requests."},
    	mergeUpstream = {method = "POST", path = "/repos/{owner}/{repo}/merge-upstream", access = "code:write", required = {"branch"}, about = "Body {branch}. Syncs a fork branch with its upstream."},
    	mergeBranch = {method = "POST", path = "/repos/{owner}/{repo}/merges", access = "code:write", required = {"base", "head"},
    		about = "Body {base, head, commit_message?}. Merges head into base; 204 when already merged."},
    
    	listCommits = {method = "GET", path = "/repos/{owner}/{repo}/commits", access = "code:read", query = {"sha", "path", "author", "committer", "since", "until", "per_page", "page"},
    		about = "Commits, newest first. sha is a branch or SHA to start from."},
    	getCommit = {method = "GET", path = "/repos/{owner}/{repo}/commits/{ref}", access = "code:read", query = {"page", "per_page"}, diff = true,
    		about = "A commit with its changed files (paged after 300 files)."},
    	compareCommits = {method = "GET", path = "/repos/{owner}/{repo}/compare/{basehead}", access = "code:read", query = {"page", "per_page"}, diff = true,
    		about = "basehead is 'base...head'. Commits, files and ahead/behind counts."},
    	getCombinedStatus = {method = "GET", path = "/repos/{owner}/{repo}/commits/{ref}/status", access = "actions:read", query = {"per_page", "page"},
    		about = "Combined commit status: state is success, pending or failure."},
    	listCommitStatuses = {method = "GET", path = "/repos/{owner}/{repo}/commits/{ref}/statuses", access = "actions:read", query = {"per_page", "page"}, about = ""},
    	createCommitStatus = {method = "POST", path = "/repos/{owner}/{repo}/statuses/{sha}", access = "actions:write", required = {"state"},
    		about = "Body {state (error, failure, pending or success), target_url?, description?, context?}."},
    	listCommitComments = {method = "GET", path = "/repos/{owner}/{repo}/commits/{commit_sha}/comments", access = "code:read", query = {"per_page", "page"},
    		about = "Comments on a commit, oldest first."},
    	createCommitComment = {method = "POST", path = "/repos/{owner}/{repo}/commits/{commit_sha}/comments", access = "code:write", required = {"body"},
    		about = "Body {body, path?, line?}. Comments on the commit, or on one line of a file it changes."},
    	listPullsForCommit = {method = "GET", path = "/repos/{owner}/{repo}/commits/{commit_sha}/pulls", access = "code:read conversations:read", query = {"per_page", "page"},
    		about = "Pull requests containing a commit."},
    	listCheckRuns = {method = "GET", path = "/repos/{owner}/{repo}/commits/{ref}/check-runs", access = "actions:read", query = {"check_name", "status", "filter", "app_id", "per_page", "page"},
    		about = "CI check runs for a ref, {total_count, check_runs}."},
    	listCheckSuites = {method = "GET", path = "/repos/{owner}/{repo}/commits/{ref}/check-suites", access = "actions:read", query = {"app_id", "check_name", "per_page", "page"},
    		about = "{total_count, check_suites}."},
    	getCheckRun = {method = "GET", path = "/repos/{owner}/{repo}/check-runs/{check_run_id}", access = "actions:read", about = "A check run with its output summary."},
    	listCheckRunAnnotations = {method = "GET", path = "/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", access = "actions:read", query = {"per_page", "page"},
    		about = "Annotations: file, line and message."},
    
    	getRef = {method = "GET", path = "/repos/{owner}/{repo}/git/ref/{ref}", access = "code:read", about = "ref is 'heads/<branch>' or 'tags/<tag>'."},
    	listMatchingRefs = {method = "GET", path = "/repos/{owner}/{repo}/git/matching-refs/{ref}", access = "code:read", about = "Refs starting with ref, such as 'heads/feature'."},
    	createRef = {method = "POST", path = "/repos/{owner}/{repo}/git/refs", access = "code:write", required = {"ref", "sha"},
    		about = "Body {ref ('refs/heads/<branch>'), sha}. Creates a branch or tag ref."},
    	updateRef = {method = "PATCH", path = "/repos/{owner}/{repo}/git/refs/{ref}", access = "code:write", required = {"sha"},
    		about = "ref is 'heads/<branch>'. Body {sha, force?}. Moves a branch."},
    	deleteRef = {method = "DELETE", path = "/repos/{owner}/{repo}/git/refs/{ref}", access = "code:write", about = "ref is 'heads/<branch>' or 'tags/<tag>'. Deletes a branch or tag."},
    	getTree = {method = "GET", path = "/repos/{owner}/{repo}/git/trees/{tree_sha}", access = "code:read", query = {"recursive"},
    		about = "recursive=true lists every path; truncated is true past 100,000 entries or 7 MB. Large recursive trees can exceed the 8 MiB result limit."},
    	createTree = {method = "POST", path = "/repos/{owner}/{repo}/git/trees", access = "code:write", required = {"tree"},
    		about = "Body {tree={{path, mode, type, sha or content}}, base_tree?}."},
    	getBlob = {method = "GET", path = "/repos/{owner}/{repo}/git/blobs/{file_sha}", access = "code:read", save = "application/vnd.github.raw+json",
    		about = "A blob, base64 in content; save_as saves its raw bytes (up to 100 MB)."},
    	createBlob = {method = "POST", path = "/repos/{owner}/{repo}/git/blobs", access = "code:write", required = {"content"}, upload = "blob",
    		about = "Body {content, encoding? ('utf-8' or 'base64')}. content_path='name' streams a session file as base64 instead of content."},
    	getGitCommit = {method = "GET", path = "/repos/{owner}/{repo}/git/commits/{commit_sha}", access = "code:read", about = "A commit object with its tree and parents."},
    	createGitCommit = {method = "POST", path = "/repos/{owner}/{repo}/git/commits", access = "code:write", required = {"message", "tree"},
    		about = "Body {message, tree, parents, author?}. Then updateRef moves the branch."},
    
    	listMyIssues = {method = "GET", path = "/issues", access = "conversations:read", query = {"filter", "state", "labels", "sort", "direction", "since", "collab", "orgs", "owned", "pulls", "per_page", "page"},
    		about = "Your issues and pull requests across GitHub. filter: assigned (default), created, mentioned, subscribed or all."},
    	listIssues = {method = "GET", path = "/repos/{owner}/{repo}/issues", access = "conversations:read",
    		query = {"milestone", "state", "assignee", "type", "creator", "mentioned", "issue_field_values", "labels", "sort", "direction", "since", "per_page", "page"},
    		about = "Issues and pull requests (with pull_request). state: open, closed or all; labels comma-separated."},
    	getIssue = {method = "GET", path = "/repos/{owner}/{repo}/issues/{issue_number}", access = "conversations:read", about = "An issue or pull request."},
    	createIssue = {method = "POST", path = "/repos/{owner}/{repo}/issues", access = "conversations:write", required = {"title"}, about = "Body {title, body?, assignees?, labels?, milestone?, type?}."},
    	updateIssue = {method = "PATCH", path = "/repos/{owner}/{repo}/issues/{issue_number}", access = "conversations:write",
    		about = "Body: fields to change, such as title, body, state ('closed'), state_reason, labels or assignees."},
    	listIssueComments = {method = "GET", path = "/repos/{owner}/{repo}/issues/{issue_number}/comments", access = "conversations:read", query = {"since", "per_page", "page"},
    		about = "Conversation comments, oldest first."},
    	createIssueComment = {method = "POST", path = "/repos/{owner}/{repo}/issues/{issue_number}/comments", access = "conversations:write", required = {"body"},
    		about = "Body {body}. Also comments on pull requests."},
    	getIssueComment = {method = "GET", path = "/repos/{owner}/{repo}/issues/comments/{comment_id}", access = "conversations:read", about = ""},
    	updateIssueComment = {method = "PATCH", path = "/repos/{owner}/{repo}/issues/comments/{comment_id}", access = "conversations:write", required = {"body"}, about = "Body {body}."},
    	deleteIssueComment = {method = "DELETE", path = "/repos/{owner}/{repo}/issues/comments/{comment_id}", access = "conversations:write", about = ""},
    	createIssueCommentReaction = {method = "POST", path = "/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", access = "conversations:write", required = {"content"},
    		about = "Body {content}, as createIssueReaction."},
    	listIssueTimeline = {method = "GET", path = "/repos/{owner}/{repo}/issues/{issue_number}/timeline", access = "conversations:read", query = {"exclude", "per_page", "page"},
    		about = "Comments, labels, references and other events."},
    	addLabels = {method = "POST", path = "/repos/{owner}/{repo}/issues/{issue_number}/labels", access = "conversations:write", required = {"labels"}, about = "Body {labels={names}}."},
    	setLabels = {method = "PUT", path = "/repos/{owner}/{repo}/issues/{issue_number}/labels", access = "conversations:write", required = {"labels"},
    		about = "Body {labels={names}}; json.decode('[]') removes all."},
    	removeLabel = {method = "DELETE", path = "/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}", access = "conversations:write", about = "Returns the remaining labels."},
    	addAssignees = {method = "POST", path = "/repos/{owner}/{repo}/issues/{issue_number}/assignees", access = "conversations:write", required = {"assignees"}, about = "Body {assignees={logins}}."},
    	removeAssignees = {method = "DELETE", path = "/repos/{owner}/{repo}/issues/{issue_number}/assignees", access = "conversations:write", required = {"assignees"}, body = true,
    		about = "Body {assignees={logins}}."},
    	listAssignees = {method = "GET", path = "/repos/{owner}/{repo}/assignees", access = "conversations:read", query = {"per_page", "page"}, about = ""},
    	createIssueReaction = {method = "POST", path = "/repos/{owner}/{repo}/issues/{issue_number}/reactions", access = "conversations:write", required = {"content"},
    		about = "Body {content}: +1, -1, laugh, confused, heart, hooray, rocket or eyes."},
    	listSubIssues = {method = "GET", path = "/repos/{owner}/{repo}/issues/{issue_number}/sub_issues", access = "conversations:read", query = {"per_page", "page"}, about = ""},
    
    	listLabels = {method = "GET", path = "/repos/{owner}/{repo}/labels", access = "conversations:read", query = {"per_page", "page"}, about = ""},
    	createLabel = {method = "POST", path = "/repos/{owner}/{repo}/labels", access = "conversations:write", required = {"name"}, about = "Body {name, color? (hex without #), description?}."},
    	updateLabel = {method = "PATCH", path = "/repos/{owner}/{repo}/labels/{name}", access = "conversations:write", about = "Body {new_name?, color?, description?}."},
    	deleteLabel = {method = "DELETE", path = "/repos/{owner}/{repo}/labels/{name}", access = "conversations:write", about = ""},
    	listMilestones = {method = "GET", path = "/repos/{owner}/{repo}/milestones", access = "conversations:read", query = {"state", "sort", "direction", "per_page", "page"}, about = ""},
    	getMilestone = {method = "GET", path = "/repos/{owner}/{repo}/milestones/{milestone_number}", access = "conversations:read", about = ""},
    	createMilestone = {method = "POST", path = "/repos/{owner}/{repo}/milestones", access = "conversations:write", required = {"title"}, about = "Body {title, state?, description?, due_on?}."},
    	updateMilestone = {method = "PATCH", path = "/repos/{owner}/{repo}/milestones/{milestone_number}", access = "conversations:write", about = "Body {title?, state?, description?, due_on?}."},
    	deleteMilestone = {method = "DELETE", path = "/repos/{owner}/{repo}/milestones/{milestone_number}", access = "conversations:write", about = ""},
    
    	listPulls = {method = "GET", path = "/repos/{owner}/{repo}/pulls", access = "conversations:read", query = {"state", "head", "base", "sort", "direction", "per_page", "page"},
    		about = "Pull requests. head is 'owner:branch'."},
    	getPull = {method = "GET", path = "/repos/{owner}/{repo}/pulls/{pull_number}", access = "conversations:read", diff = true, about = "A pull request with mergeable state and counts."},
    	createPull = {method = "POST", path = "/repos/{owner}/{repo}/pulls", access = "conversations:write", required = {"head", "base"},
    		about = "Body {head, base, title or issue, body?, draft?, maintainer_can_modify?}."},
    	updatePull = {method = "PATCH", path = "/repos/{owner}/{repo}/pulls/{pull_number}", access = "conversations:write", about = "Body: title, body, state, base or maintainer_can_modify."},
    	mergePull = {method = "PUT", path = "/repos/{owner}/{repo}/pulls/{pull_number}/merge", access = "code:write conversations:write",
    		about = "Body {merge_method? (merge, squash or rebase), commit_title?, commit_message?, sha?}. sha must match the head to merge."},
    	updatePullBranch = {method = "PUT", path = "/repos/{owner}/{repo}/pulls/{pull_number}/update-branch", access = "code:write conversations:write",
    		about = "Body {expected_head_sha?}. Merges the base into the head branch, asynchronously."},
    	listPullFiles = {method = "GET", path = "/repos/{owner}/{repo}/pulls/{pull_number}/files", access = "code:read conversations:read", query = {"per_page", "page"},
    		about = "Changed files with patches; at most 3,000 files."},
    	listPullCommits = {method = "GET", path = "/repos/{owner}/{repo}/pulls/{pull_number}/commits", access = "code:read conversations:read", query = {"per_page", "page"}, about = "At most 250 commits."},
    	listPullReviews = {method = "GET", path = "/repos/{owner}/{repo}/pulls/{pull_number}/reviews", access = "conversations:read", query = {"per_page", "page"}, about = "Reviews, oldest first."},
    	getPullReview = {method = "GET", path = "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}", access = "conversations:read", about = "A review with its state and body."},
    	createPullReview = {method = "POST", path = "/repos/{owner}/{repo}/pulls/{pull_number}/reviews", access = "conversations:write",
    		about = "Body {event? (APPROVE, REQUEST_CHANGES or COMMENT; omit for a pending review), body?, commit_id?, comments?={{path, line, side?, body}}}."},
    	submitPullReview = {method = "POST", path = "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events", access = "conversations:write", required = {"event"},
    		about = "Body {event, body?}. Submits a pending review."},
    	dismissPullReview = {method = "PUT", path = "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals", access = "conversations:write", required = {"message"},
    		about = "Body {message}. Needs admin or a branch protection bypass."},
    	deletePendingReview = {method = "DELETE", path = "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}", access = "conversations:write", about = "Deletes an unsubmitted review."},
    	listPullReviewComments = {method = "GET", path = "/repos/{owner}/{repo}/pulls/{pull_number}/comments", access = "conversations:read", query = {"sort", "direction", "since", "per_page", "page"},
    		about = "Line comments on the diff."},
    	createPullReviewComment = {method = "POST", path = "/repos/{owner}/{repo}/pulls/{pull_number}/comments", access = "conversations:write", required = {"body", "commit_id", "path"},
    		about = "Body {body, commit_id, path, line, side?, start_line?, subject_type?}."},
    	replyToReviewComment = {method = "POST", path = "/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies", access = "conversations:write", required = {"body"},
    		about = "Body {body}. comment_id is a top-level review comment."},
    	getPullReviewComment = {method = "GET", path = "/repos/{owner}/{repo}/pulls/comments/{comment_id}", access = "conversations:read", about = "A line comment on the diff."},
    	updatePullReviewComment = {method = "PATCH", path = "/repos/{owner}/{repo}/pulls/comments/{comment_id}", access = "conversations:write", required = {"body"}, about = "Body {body}."},
    	deletePullReviewComment = {method = "DELETE", path = "/repos/{owner}/{repo}/pulls/comments/{comment_id}", access = "conversations:write", about = ""},
    	createPullReviewCommentReaction = {method = "POST", path = "/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", access = "conversations:write", required = {"content"},
    		about = "Body {content}, as createIssueReaction."},
    	listRequestedReviewers = {method = "GET", path = "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", access = "conversations:read", about = "{users, teams}."},
    	requestReviewers = {method = "POST", path = "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", access = "conversations:write",
    		about = "Body {reviewers?={logins}, team_reviewers?={slugs}}."},
    	removeRequestedReviewers = {method = "DELETE", path = "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", access = "conversations:write", required = {"reviewers"}, body = true,
    		about = "Body {reviewers={logins}, team_reviewers?}."},
    
    	listReleases = {method = "GET", path = "/repos/{owner}/{repo}/releases", access = "code:read", query = {"per_page", "page"}, about = "Releases, including drafts with push access."},
    	getRelease = {method = "GET", path = "/repos/{owner}/{repo}/releases/{release_id}", access = "code:read", about = "A release with its assets."},
    	getLatestRelease = {method = "GET", path = "/repos/{owner}/{repo}/releases/latest", access = "code:read", about = "The latest published full release."},
    	getReleaseByTag = {method = "GET", path = "/repos/{owner}/{repo}/releases/tags/{tag}", access = "code:read", about = "A published release by tag name."},
    	createRelease = {method = "POST", path = "/repos/{owner}/{repo}/releases", access = "code:write", required = {"tag_name"},
    		about = "Body {tag_name, target_commitish?, name?, body?, draft?, prerelease?, generate_release_notes?, make_latest?}. Publishing notifies watchers."},
    	updateRelease = {method = "PATCH", path = "/repos/{owner}/{repo}/releases/{release_id}", access = "code:write", about = "Body: fields to change; draft=false publishes."},
    	deleteRelease = {method = "DELETE", path = "/repos/{owner}/{repo}/releases/{release_id}", access = "code:write", about = "Deletes a release, not its tag."},
    	generateReleaseNotes = {method = "POST", path = "/repos/{owner}/{repo}/releases/generate-notes", access = "code:write", required = {"tag_name"},
    		about = "Body {tag_name, previous_tag_name?, target_commitish?}. Returns {name, body} and saves nothing."},
    	listReleaseAssets = {method = "GET", path = "/repos/{owner}/{repo}/releases/{release_id}/assets", access = "code:read", query = {"per_page", "page"}, about = ""},
    	getReleaseAsset = {method = "GET", path = "/repos/{owner}/{repo}/releases/assets/{asset_id}", access = "code:read", save = "application/octet-stream",
    		about = "Asset metadata; save_as saves the asset's bytes as a session file."},
    	deleteReleaseAsset = {method = "DELETE", path = "/repos/{owner}/{repo}/releases/assets/{asset_id}", access = "code:write", about = ""},
    
    	listWorkflows = {method = "GET", path = "/repos/{owner}/{repo}/actions/workflows", access = "actions:read", query = {"per_page", "page"}, about = "{total_count, workflows}."},
    	getWorkflow = {method = "GET", path = "/repos/{owner}/{repo}/actions/workflows/{workflow_id}", access = "actions:read", about = "workflow_id is the ID or file name, such as 'ci.yml'."},
    	dispatchWorkflow = {method = "POST", path = "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", access = "actions:write", required = {"ref"},
    		about = "Body {ref, inputs?}. Starts a workflow_dispatch run and returns its run ID and URLs."},
    	listWorkflowRuns = {method = "GET", path = "/repos/{owner}/{repo}/actions/runs", access = "actions:read",
    		query = {"actor", "branch", "event", "status", "created", "exclude_pull_requests", "check_suite_id", "head_sha", "per_page", "page"},
    		about = "{total_count, workflow_runs}, newest first."},
    	listRunsForWorkflow = {method = "GET", path = "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", access = "actions:read",
    		query = {"actor", "branch", "event", "status", "created", "exclude_pull_requests", "check_suite_id", "head_sha", "per_page", "page"},
    		about = "Runs of one workflow, as listWorkflowRuns."},
    	getWorkflowRun = {method = "GET", path = "/repos/{owner}/{repo}/actions/runs/{run_id}", access = "actions:read", query = {"exclude_pull_requests"}, about = "A run with status and conclusion."},
    	cancelWorkflowRun = {method = "POST", path = "/repos/{owner}/{repo}/actions/runs/{run_id}/cancel", access = "actions:write", about = ""},
    	rerunWorkflow = {method = "POST", path = "/repos/{owner}/{repo}/actions/runs/{run_id}/rerun", access = "actions:write", about = "Body {enable_debug_logging?}. Reruns every job."},
    	rerunFailedJobs = {method = "POST", path = "/repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs", access = "actions:write", about = "Body {enable_debug_logging?}."},
    	downloadRunLogs = {method = "GET", path = "/repos/{owner}/{repo}/actions/runs/{run_id}/logs", access = "actions:read", required = {"save_as"}, save = JSON,
    		about = "Saves a .zip of every job's logs."},
    	listRunJobs = {method = "GET", path = "/repos/{owner}/{repo}/actions/runs/{run_id}/jobs", access = "actions:read", query = {"filter", "per_page", "page"},
    		about = "{total_count, jobs} with steps and conclusions. filter: latest or all."},
    	getJob = {method = "GET", path = "/repos/{owner}/{repo}/actions/jobs/{job_id}", access = "actions:read", about = "A job with its steps."},
    	downloadJobLogs = {method = "GET", path = "/repos/{owner}/{repo}/actions/jobs/{job_id}/logs", access = "actions:read", required = {"save_as"}, save = JSON,
    		about = "Saves a job's plain-text log; search it with fs.grep."},
    	listArtifacts = {method = "GET", path = "/repos/{owner}/{repo}/actions/artifacts", access = "actions:read", query = {"name", "per_page", "page"}, about = "{total_count, artifacts}."},
    	listRunArtifacts = {method = "GET", path = "/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", access = "actions:read", query = {"name", "direction", "per_page", "page"},
    		about = ""},
    	downloadArtifact = {method = "GET", path = "/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}", access = "actions:read", required = {"save_as"}, save = JSON,
    		about = "archive_format is 'zip'. Saves the artifact's .zip."},
    
    	searchRepos = {method = "GET", path = "/search/repositories", query = {"q", "sort", "order", "per_page", "page"}, required = {"q"},
    		about = "q such as 'houston language:go stars:>10'."},
    	searchCode = {method = "GET", path = "/search/code", access = "code:read", query = {"q", "sort", "order", "per_page", "page"}, required = {"q"},
    		about = "q such as 'fetchUser repo:octo/app language:ts'; default branches only. 10 requests per minute."},
    	searchIssues = {method = "GET", path = "/search/issues", access = "conversations:read", query = {"q", "sort", "order", "per_page", "page", "advanced_search", "search_type"}, required = {"q"},
    		about = "Issues and pull requests; q such as 'repo:octo/app is:pr is:open review-requested:@me'."},
    	searchCommits = {method = "GET", path = "/search/commits", access = "code:read", query = {"q", "sort", "order", "per_page", "page"}, required = {"q"}, about = "q such as 'repo:octo/app fix'."},
    	searchUsers = {method = "GET", path = "/search/users", query = {"q", "sort", "order", "per_page", "page"}, required = {"q"}, about = ""},
    
    	listGists = {method = "GET", path = "/gists", access = "gists:read", query = {"since", "per_page", "page"}, about = ""},
    	listUserGists = {method = "GET", path = "/users/{username}/gists", access = "gists:read", query = {"since", "per_page", "page"}, about = ""},
    	getGist = {method = "GET", path = "/gists/{gist_id}", access = "gists:read", about = "A gist with file contents, truncated past 1 MB (truncated=true); downloadGistFile saves a whole file."},
    	createGist = {method = "POST", path = "/gists", access = "gists:write", required = {"files"}, about = "Body {files={['name.md']={content}}, description?, public? (default false)}."},
    	updateGist = {method = "PATCH", path = "/gists/{gist_id}", access = "gists:write", about = "Body {description?, files?}; a file set to json.decode('null') is deleted."},
    	deleteGist = {method = "DELETE", path = "/gists/{gist_id}", access = "gists:write", about = ""},
    }
    local NULL = json.decode("null")
    local NONE: {string} = table.freeze({})
    
    -- Branch, ref, path, tag, tree, compare and label values may contain slashes and percent signs;
    -- GitHub accepts them encoded.
    local OPAQUE = table.freeze({branch = true, ref = true, path = true, basehead = true, tag = true, name = true, tree_sha = true})
    local DOWNLOAD_HOSTS = table.freeze({"codeload.github.com", "release-assets.githubusercontent.com", "objects.githubusercontent.com",
    	"objects-origin.githubusercontent.com", "github-releases.githubusercontent.com"})
    
    local function options(input: Options?): Options
    	if input == nil then return {} end
    	assert(type(input) == "table", "opts must be an object")
    	for key in input do assert(type(key) == "string", "opts must have named fields") end
    	return table.clone(input)
    end
    
    local function text(value: any, field: string): string
    	assert(type(value) == "string" and value ~= "" and not string.find(value, "%c"), field .. " must be a nonempty string without control characters")
    	return value
    end
    
    local function segment(value: any, field: string): string
    	if string.match(field, "_number$") or (string.match(field, "_id$") and field ~= "workflow_id" and field ~= "gist_id") then
    		local number = if type(value) == "string" and string.match(value, "^%d+$") then tonumber(value) else value
    		assert(type(number) == "number" and number % 1 == 0 and number >= 1 and number < 2 ^ 53, field .. " must be a positive integer")
    		return string.format("%d", number)
    	end
    	if OPAQUE[field] then
    		-- GitHub decodes each part once, so a literal percent sign travels as %25. Each part passes
    		-- url.segment (no dot part, backslash or look-alike traversal) once its own escapes are decoded
    		-- up to 16 times, as the proxy's opaque check does, so no escape adds a separator or dot part
    		-- and that check never has to refuse it; the slashes travel encoded.
    		local parts: {string} = {}
    		for _, part in string.split(text(value, field), "/") do
    			local seen, escapes = part, 1
    			for _ = 1, 16 do
    				if escapes == 0 then break end
    				seen, escapes = string.gsub(seen, "%%(%x%x)", function(hex: string): string return string.char(tonumber(hex, 16) :: number) end)
    			end
    			local ok = escapes == 0 and pcall(url.segment, (string.gsub(seen, "%%", "_")))
    			assert(ok, field .. " must be slash-separated names without empty, . or .. parts, backslashes or escaped separators")
    			table.insert(parts, url.encode(part))
    		end
    		return table.concat(parts, "%2F")
    	end
    	-- workflow_id is a numeric ID or a file name.
    	if type(value) == "number" and value % 1 == 0 and value >= 1 and value < 2 ^ 53 then value = string.format("%d", value) end
    	local ok, result = pcall(url.segment, value, field)
    	assert(ok, field .. " must be a GitHub name or SHA")
    	return result
    end
    
    local function scalar(value: any, field: string): string
    	local kind = type(value)
    	assert(kind == "string" or kind == "boolean" or kind == "number", field .. " must be a string, boolean or number")
    	return url.encode(value)
    end
    
    local function header(response: HttpResponse, name: string): string?
    	local values = response.headers[name]
    	return if values and values[1] then string.sub(values[1], 1, 200) else nil
    end
    
    -- GitHub errors are {message, documentation_url?, errors?: [{resource, field, code, message?}], status}.
    -- Primary rate limits answer 403 or 429 with x-ratelimit-remaining 0; secondary ones may add
    -- retry-after, and otherwise only say so in the message.
    local function fail(name: string, response: HttpResponse): never
    	local message = "GitHub HTTP " .. tostring(response.statusCode)
    	local ok, value = pcall(json.decode, await(response.body:readPrefix(16 * 1024)))
    	if ok and type(value) == "table" then
    		if type(value.message) == "string" then message ..= ": " .. string.sub(value.message, 1, 600) end
    		if type(value.errors) == "table" then message ..= " " .. string.sub(json.encode(value.errors), 1, 600) end
    	end
    	local retryAfter = header(response, "retry-after")
    	local exhausted = header(response, "x-ratelimit-remaining") == "0"
    	local secondary = string.find(message, "secondary rate limit", 1, true) ~= nil
    	if retryAfter then message ..= "; retry after " .. retryAfter .. "s" end
    	if exhausted then message ..= "; rate limit resets at " .. (header(response, "x-ratelimit-reset") or "?") .. " (Unix time)" end
    	-- Renamed or transferred repositories redirect to /repositories/<id>, which no rule allows.
    	local moved = header(response, "location")
    	if moved and string.find(moved, "https://api.github.com/repositories/", 1, true) == 1 then
    		message ..= "; the repository was renamed or transferred: use its new owner and name"
    	elseif moved and string.find(moved, "https://api.github.com/", 1, true) == 1 then
    		-- Renamed branches and transferred issues name their new route; drop any query.
    		message ..= "; moved to " .. (string.match(string.sub(moved, #"https://api.github.com" + 1), "^[^?#]*") or "")
    	end
    	local accepted = header(response, "x-accepted-github-permissions")
    	if accepted then message ..= "; needs permissions " .. accepted end
    	local status = response.statusCode
    	return houston.fail({operation = name, layer = "upstream", upstream_status = status,
    		retryable = status == 429 or status >= 500 or (status == 403 and (exhausted or secondary or retryAfter ~= nil)), message = message})
    end
    
    -- Private repositories carry short-lived tokens usable outside Houston: file links keep their
    -- path without the token, and repository clone tokens are dropped.
    local function unsign(value: any)
    	if type(value) ~= "table" then return end
    	for key, child in value do
    		if key == "download_url" and type(child) == "string" then
    			value[key] = string.match(child, "^[^?]*")
    		elseif key == "temp_clone_token" then
    			value[key] = nil
    		else
    			unsign(child)
    		end
    	end
    end
    
    -- Writes answer 204 without a body; reads answer 204 for an empty list, such as an
    -- empty repository's contributors.
    local function decode(name: string, endpoint: Endpoint, response: HttpResponse): any
    	if response.statusCode == 204 then
    		response.body:close()
    		return if endpoint.method == "GET" then json.decode("[]") else {success = true}
    	end
    	local raw = await(response.body:readAll())
    	local ok, value = pcall(json.decode, raw)
    	if not ok or type(value) ~= "table" then
    		return houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode, retryable = false,
    			message = "GitHub returned invalid JSON"})
    	end
    	unsign(value)
    	return value
    end
    
    local function allowedDownload(location: string): boolean
    	local host = string.match(location, "^https://([%w%.%-]+)/")
    	if host == nil then return false end
    	host = string.lower(host)
    	return table.find(DOWNLOAD_HOSTS, host) ~= nil or string.match(host, "^productionresultssa%d+%.blob%.core%.windows%.net$") ~= nil
    		or string.match(host, "^[%w%-]+%.actions%.githubusercontent%.com$") ~= nil
    end
    
    local function store(name: string, response: HttpResponse, output: any, destination: string): any
    	if response.statusCode ~= 200 then fail(name, response) end
    	output:write(response.body)
    	await(output:close())
    	return {path = destination, size = await(fs.stat(destination)).size, url = await(fs.signedGetUrl(destination))}
    end
    
    -- Archives, assets and logs redirect to a signed URL, fetched without credentials.
    local function save(name: string, first: HttpResponse, output: any, destination: string): any
    	local response = first
    	local location = first.headers.location
    	local target = if location then location[1] else nil
    	local kind = first.headers["content-type"]
    	if first.statusCode >= 300 and first.statusCode < 400 and target then
    		if string.find(target, "https://api.github.com/", 1, true) == 1 then fail(name, first) end
    		first.body:close()
    		if not allowedDownload(target) then
    			return houston.fail({operation = name, layer = "upstream", upstream_status = first.statusCode, retryable = false,
    				message = "GitHub redirected the download to an unexpected host"})
    		end
    		response = await(http.request({method = "GET", url = target}))
    		if response.statusCode ~= 200 then
    			-- Signed links expire within minutes; a new call fetches a fresh one.
    			response.body:close()
    			local status = response.statusCode
    			local fresh = status == 403 or status == 429 or status >= 500
    			return houston.fail({operation = name, layer = "upstream", upstream_status = status, retryable = fresh,
    				message = "The signed download link failed with HTTP " .. tostring(status) .. (if fresh then "; call again for a fresh link" else "")})
    		end
    	elseif first.statusCode == 200 and kind and string.find(kind[1], "application/json", 1, true) == 1 then
    		-- Directories and submodules answer with JSON even when raw bytes are requested.
    		first.body:close()
    		return houston.fail({operation = name, layer = "upstream", upstream_status = 200, retryable = false,
    			message = "The path is a directory or submodule; call getContent without save_as to inspect it"})
    	end
    	return store(name, response, output, destination)
    end
    
    -- Open the destination before any request, so a malformed path never reaches GitHub; cancel it on failure, which keeps the previous file.
    local function download(destination: string, fetch: (any) -> any): any
    	local output = await(fs.open(destination, "w"))
    	local ok, result = pcall(fetch, output)
    	if not ok then
    		output:cancel()
    		pcall(function() await(output:close()) end) -- raises cancelled once the path is free again
    		error(result, 0)
    	end
    	return result
    end
    
    -- A JSON body whose content field is a session file's base64, streamed so the file never
    -- becomes a string and can exceed the 8 MiB limit on strings.
    -- The other fields are never empty: putFile requires message, and createBlob sets encoding.
    local function streamedBody(args: Options, file: string): any
    	local rest = string.sub(json.encode(args), 2)
    	return stream.concat({'{"content":"', base64.encode(fs.open(file, "r")), '",' .. rest})
    end
    
    local function request(name: string, endpoint: Endpoint, input: Options?): any
    	local args = options(input)
    	local file: string? = nil
    	if endpoint.upload and args.content_path ~= nil then
    		local source = text(args.content_path, "content_path")
    		file = source
    		assert(args.content == nil, "pass content or content_path, not both")
    		args.content_path = nil
    		if endpoint.upload == "blob" then
    			assert(args.encoding == nil or args.encoding == "base64", "content_path sends base64; omit encoding")
    			args.encoding = "base64"
    		end
    		assert(await(fs.stat(source)).isFile, "content_path must be a session file")
    	end
    	local path = string.gsub(endpoint.path, "{([%w_]+)}", function(field: string)
    		local value = segment(args[field], field)
    		args[field] = nil
    		return value
    	end)
    	for _, field in endpoint.required or NONE do
    		assert((args[field] ~= nil and args[field] ~= NULL) or (field == "content" and file ~= nil), field .. " is required")
    	end
    	local headers: HttpHeaders = {Accept = {JSON}, ["X-GitHub-Api-Version"] = {VERSION}}
    	local destination: string? = nil
    	if endpoint.save and args.save_as ~= nil then
    		destination = text(args.save_as, "save_as")
    		headers.Accept = {endpoint.save}
    		args.save_as = nil
    	end
    	local format = if endpoint.diff then args.format else nil
    	if format ~= nil then
    		assert(format == "diff" or format == "patch", "format must be 'diff' or 'patch'")
    		-- A pull request's diff is code, so it needs Code read like listPullFiles.
    		assert(houston.allows("code:read"), "format needs Code read access")
    		headers.Accept = {"application/vnd.github." .. format}
    		args.format = nil
    	end
    	-- getTree recurses for any recursive value, false included.
    	if name == "getTree" and args.recursive ~= nil then
    		assert(type(args.recursive) == "boolean", "recursive must be true or false")
    		if not args.recursive then args.recursive = nil end
    	end
    	local query: {string} = {}
    	for _, field in endpoint.query or NONE do
    		if args[field] ~= nil then table.insert(query, field .. "=" .. scalar(args[field], field)) end
    		args[field] = nil
    	end
    	if #query > 0 then path ..= "?" .. table.concat(query, "&") end
    	local body: any = nil
    	local sends = if endpoint.body == nil then endpoint.method == "POST" or endpoint.method == "PATCH" or endpoint.method == "PUT" else endpoint.body
    	if sends then
    		headers["Content-Type"] = {"application/json"}
    		body = if file then streamedBody(args, file) else json.encode(args)
    		args = {}
    	end
    	local unknown = next(args)
    	assert(unknown == nil, name .. " has no option " .. tostring(unknown))
    	local call: HttpRequest = {url = API .. path, method = endpoint.method, headers = headers, body = body}
    	if destination == nil then
    		local response = await(http.request(call))
    		if response.statusCode < 200 or response.statusCode >= 300 then fail(name, response) end
    		if format then return await(response.body:readAll()) end
    		return decode(name, endpoint, response)
    	end
    	return download(destination, function(output: any): any return save(name, await(http.request(call)), output, destination) end)
    end
    
    local exports: {[string]: any} = {}
    for name, endpoint in endpoints do
    	if (endpoint.access == nil or houston.allows(endpoint.access)) and (endpoint.auth == nil or endpoint.auth == auth.method) then
    		exports[name] = function(args: Options?): any return request(name, endpoint, args) end
    	end
    end
    
    -- getGist truncates file contents past 1 MB; raw_url serves the whole file at its revision,
    -- without credentials.
    local GIST_FILES = "https://gist.githubusercontent.com/"
    local function downloadGistFile(input: Options?): any
    	local args = options(input)
    	local filename = text(args.filename, "filename")
    	local destination = text(args.save_as, "save_as")
    	args.filename, args.save_as = nil, nil
    	return download(destination, function(output: any): any
    		local file = request("downloadGistFile", endpoints.getGist, args).files[filename]
    		local target = if type(file) == "table" then file.raw_url else nil
    		if type(target) ~= "string" or string.find(target, GIST_FILES, 1, true) ~= 1 then
    			return houston.fail({operation = "downloadGistFile", layer = "upstream", upstream_status = 200, retryable = false,
    				message = "The gist has no file named " .. string.sub(filename, 1, 200)})
    		end
    		return store("downloadGistFile", await(http.request({method = "GET", url = target})), output, destination)
    	end)
    end
    if exports.getGist then exports.downloadGistFile = downloadGistFile end
    
    local REPO = "/repos/{owner}/{repo}"
    
    -- name({path fields, query fields?}) built from the endpoint itself. Repository routes leave
    -- owner and repo implicit, page? stands for per_page and page, and Body {...} lists body fields.
    local function signature(endpoint: Endpoint): string
    	local fields: {string} = {}
    	local inRepo = string.sub(endpoint.path, 1, #REPO) == REPO
    	for field in string.gmatch(endpoint.path, "{([%w_]+)}") do
    		if not inRepo or (field ~= "owner" and field ~= "repo") then table.insert(fields, field) end
    	end
    	local required = endpoint.required or NONE
    	for _, field in endpoint.query or NONE do
    		if field ~= "per_page" then table.insert(fields, if table.find(required, field) then field else field .. "?") end
    	end
    	if endpoint.save then table.insert(fields, if table.find(required, "save_as") then "save_as" else "save_as?") end
    	if endpoint.diff then table.insert(fields, "format?") end
    	if endpoint.upload then table.insert(fields, "content_path?") end
    	return "({" .. table.concat(fields, ", ") .. "})"
    end
    
    exports.help = function(): string
    	local lines = {
    		"GitHub REST API " .. VERSION .. ". Each function takes one options object with GitHub's snake_case names (? marks optional); writes also take the JSON body fields listed after Body. Results are GitHub's JSON unchanged; write replies without a body return {success=true}. Connector calls return completed values: use them directly, without await. In bodies, json.decode('[]') is an empty array and json.decode('null') clears a field.",
    		"Start with github.getAuthenticatedUser().login, github.listMyRepos({sort='pushed', per_page=20}) or github.searchIssues({q='is:pr is:open author:@me'}); github.listUserEvents({username=login}) gives recent activity. branch, ref, path, tag, tree_sha, basehead and label name may contain slashes and percent signs (ref='heads/feature/x', path='src/100%.md'), but not backslashes or escapes of separators and dots such as %2F.",
    		"Lists return one page: page? means per_page (1..100, default 30) and page (from 1); a shorter page is the last. JSON and text results over 8 MiB fail; use save_as or smaller pages. Search returns {total_count, incomplete_results, items}: at most 1,000 results and 30 requests per minute (searchCode 10).",
    		"Files: getContent returns base64 content; save_as='name' saves raw bytes as a session file instead. Houston requests and replies stop at 8 MiB, so base64 content in getContent and getBlob carries at most about 6 MiB of file: read larger files with save_as. putFile and createBlob take content_path='name' instead of content to stream a session file of any size up to GitHub's 100 MB file limit. download_url links lose their private-repository token (fetch private files with save_as), and temp_clone_token is removed. save_as functions return {path, size, url} and replace that session file only when the download succeeds; a failed download leaves it as it was; search large logs with fs.grep. getCommit, compareCommits and getPull take format='diff' or 'patch' and return that text, without paging. To commit several files, chain createBlob, createTree, createGitCommit and updateRef.",
    		"Access: GitHub enforces the token's permissions and repository selection; Connect with GitHub reaches public data and repositories where Houston's GitHub App is installed. A 403 or 404 may mean missing access; errors give GitHub's message, needed permissions and rate-limit resets. Houston also enforces this connection's access levels: functions they do not allow are omitted, and format on getPull needs Code read. Installation lists need Connect with GitHub; check runs and suites need a classic token or Connect with GitHub.",
    		"Writes can notify people and trigger workflows. No automatic retries: after a timeout or 5xx, read the resource again before repeating a write. Repository deletion, settings administration, secrets, webhooks, deploy keys and GraphQL are not exposed.",
    	}
    	local names: {string} = {}
    	for name in exports do if name ~= "help" then table.insert(names, name) end end
    	table.sort(names)
    	local repository: {string} = {"Repository functions also take owner and repo, such as owner='octocat', repo='Hello-World'; ... stands for " .. REPO .. ":"}
    	for _, name in names do
    		local endpoint = endpoints[name]
    		if endpoint == nil then
    			table.insert(lines, name .. "({gist_id, filename, save_as}): Saves one gist file whole (up to 10 MB) as a session file. GET raw_url")
    			continue
    		end
    		local inRepo = string.sub(endpoint.path, 1, #REPO) == REPO
    		local route = if inRepo then "..." .. string.sub(endpoint.path, #REPO + 1) else endpoint.path
    		local about = if endpoint.about == "" then "" else endpoint.about .. " "
    		table.insert(if inRepo then repository else lines, name .. signature(endpoint) .. ": " .. about .. endpoint.method .. " " .. route)
    	end
    	table.move(repository, 1, #repository, #lines + 1, lines)
    	return table.concat(lines, "\n")
    end
    return exports
    
  • houston.json
    {
      "schema_version": 2,
      "name": "GitHub",
      "files": [
        "connector.luau"
      ],
      "icon": "icon.svg",
      "access": [
        {
          "name": "code",
          "label": "Code and releases",
          "description": "Files, branches, commits, merges and releases, including archives and release downloads.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "read",
              "label": "Read"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "read"
        },
        {
          "name": "conversations",
          "label": "Issues and pull requests",
          "description": "Issues, pull requests, comments, reviews, labels and milestones. Pull request files, commits and merges also need Code.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "read",
              "label": "Read"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "read"
        },
        {
          "name": "actions",
          "label": "Actions, checks and statuses",
          "description": "Workflows, runs, jobs, logs, artifacts, check runs and commit statuses.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "read",
              "label": "Read"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "read"
        },
        {
          "name": "gists",
          "label": "Gists",
          "description": "Gists and their files.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "read",
              "label": "Read"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "none"
        },
        {
          "name": "stars",
          "label": "Stars",
          "description": "Starred repositories.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "read",
              "label": "Read"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "none"
        },
        {
          "name": "organizations",
          "label": "Organizations and teams",
          "description": "Your organizations, their members and teams.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "read",
              "label": "Read"
            }
          ],
          "default": "read"
        },
        {
          "name": "emails",
          "label": "Email addresses",
          "description": "Your email addresses, including private ones.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "read",
              "label": "Read"
            }
          ],
          "default": "none"
        },
        {
          "name": "repositories",
          "label": "Create and fork repositories",
          "description": "New repositories in your account or organizations, and forks.",
          "levels": [
            {
              "value": "none",
              "label": "None"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "none"
        }
      ],
      "auth": {
        "oauth": {
          "account": {
            "headers": {
              "Authorization": {
                "value": "Bearer {{auth.oauth.access_token}}"
              },
              "Accept": {
                "value": "application/vnd.github+json"
              }
            },
            "label": "/login",
            "method": "GET",
            "url": "https://api.github.com/user"
          },
          "authorize_url": "https://github.com/login/oauth/authorize",
          "client_auth": "body",
          "client_id": "{{publisher.client_id}}",
          "client_secret": "{{publisher.client_secret}}",
          "label": "Connect with GitHub",
          "brand": "github",
          "pkce": "S256",
          "require_refresh": true,
          "token_headers": {
            "Accept": "application/json"
          },
          "token_url": "https://github.com/login/oauth/access_token",
          "type": "oauth2"
        },
        "token": {
          "config": {
            "token": {
              "label": "Token",
              "required": true,
              "type": "secret"
            }
          },
          "label": "Personal access token",
          "setup_url": "https://github.com/settings/personal-access-tokens/new?name=Houston&description=Houston%20connection",
          "setup_params": {
            "contents": "code",
            "issues": "conversations",
            "pull_requests": "conversations",
            "actions": "actions",
            "statuses": "actions",
            "starring": "stars",
            "members": "organizations",
            "emails": "emails",
            "administration": "repositories"
          },
          "type": "manual"
        }
      },
      "publisher": {
        "client_id": {
          "label": "GitHub App client ID",
          "order": 1,
          "type": "string"
        },
        "client_secret": {
          "label": "GitHub App client secret",
          "order": 2,
          "type": "secret"
        }
      },
      "proxy": [
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/orgs/{org}/repos",
              "/rate_limit",
              "/repos/{owner}/{repo}",
              "/repos/{owner}/{repo}/contributors",
              "/repos/{owner}/{repo}/forks",
              "/repos/{owner}/{repo}/languages",
              "/repos/{owner}/{repo}/stargazers",
              "/repos/{owner}/{repo}/topics",
              "/search/repositories",
              "/search/users",
              "/user",
              "/user/installations",
              "/user/installations/{installation_id}/repositories",
              "/user/repos",
              "/users/{username}",
              "/users/{username}/repos"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/repos/{owner}/{repo}/branches",
              "/repos/{owner}/{repo}/commits",
              "/repos/{owner}/{repo}/commits/{commit_sha}/comments",
              "/repos/{owner}/{repo}/git/blobs/{file_sha}",
              "/repos/{owner}/{repo}/git/commits/{commit_sha}",
              "/repos/{owner}/{repo}/readme",
              "/repos/{owner}/{repo}/releases",
              "/repos/{owner}/{repo}/releases/assets/{asset_id}",
              "/repos/{owner}/{repo}/releases/latest",
              "/repos/{owner}/{repo}/releases/{release_id}",
              "/repos/{owner}/{repo}/releases/{release_id}/assets",
              "/repos/{owner}/{repo}/tags",
              "/search/code",
              "/search/commits"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "basehead"
            ],
            "path": [
              "/repos/{owner}/{repo}/compare/{basehead}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "branch"
            ],
            "path": [
              "/repos/{owner}/{repo}/branches/{branch}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "path"
            ],
            "path": [
              "/repos/{owner}/{repo}/contents/{path}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "ref"
            ],
            "path": [
              "/repos/{owner}/{repo}/commits/{ref}",
              "/repos/{owner}/{repo}/git/matching-refs/{ref}",
              "/repos/{owner}/{repo}/git/ref/{ref}",
              "/repos/{owner}/{repo}/tarball/{ref}",
              "/repos/{owner}/{repo}/zipball/{ref}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "tag"
            ],
            "path": [
              "/repos/{owner}/{repo}/releases/tags/{tag}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "tree_sha"
            ],
            "path": [
              "/repos/{owner}/{repo}/git/trees/{tree_sha}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/repos/{owner}/{repo}/releases/assets/{asset_id}",
              "/repos/{owner}/{repo}/releases/{release_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "PATCH"
            ],
            "path": [
              "/repos/{owner}/{repo}/releases/{release_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/repos/{owner}/{repo}/commits/{commit_sha}/comments",
              "/repos/{owner}/{repo}/git/blobs",
              "/repos/{owner}/{repo}/git/commits",
              "/repos/{owner}/{repo}/git/refs",
              "/repos/{owner}/{repo}/git/trees",
              "/repos/{owner}/{repo}/merge-upstream",
              "/repos/{owner}/{repo}/merges",
              "/repos/{owner}/{repo}/releases",
              "/repos/{owner}/{repo}/releases/generate-notes"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "POST"
            ],
            "opaque_path_parameters": [
              "branch"
            ],
            "path": [
              "/repos/{owner}/{repo}/branches/{branch}/rename"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "DELETE",
              "PUT"
            ],
            "opaque_path_parameters": [
              "path"
            ],
            "path": [
              "/repos/{owner}/{repo}/contents/{path}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.code \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "DELETE",
              "PATCH"
            ],
            "opaque_path_parameters": [
              "ref"
            ],
            "path": [
              "/repos/{owner}/{repo}/git/refs/{ref}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.conversations \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/issues",
              "/repos/{owner}/{repo}/assignees",
              "/repos/{owner}/{repo}/collaborators",
              "/repos/{owner}/{repo}/issues",
              "/repos/{owner}/{repo}/issues/comments/{comment_id}",
              "/repos/{owner}/{repo}/issues/{issue_number}",
              "/repos/{owner}/{repo}/issues/{issue_number}/comments",
              "/repos/{owner}/{repo}/issues/{issue_number}/sub_issues",
              "/repos/{owner}/{repo}/issues/{issue_number}/timeline",
              "/repos/{owner}/{repo}/labels",
              "/repos/{owner}/{repo}/milestones",
              "/repos/{owner}/{repo}/milestones/{milestone_number}",
              "/repos/{owner}/{repo}/pulls",
              "/repos/{owner}/{repo}/pulls/comments/{comment_id}",
              "/repos/{owner}/{repo}/pulls/{pull_number}",
              "/repos/{owner}/{repo}/pulls/{pull_number}/comments",
              "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers",
              "/repos/{owner}/{repo}/pulls/{pull_number}/reviews",
              "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}",
              "/search/issues"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.conversations \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/repos/{owner}/{repo}/issues/comments/{comment_id}",
              "/repos/{owner}/{repo}/issues/{issue_number}/assignees",
              "/repos/{owner}/{repo}/milestones/{milestone_number}",
              "/repos/{owner}/{repo}/pulls/comments/{comment_id}",
              "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers",
              "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.conversations \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "DELETE"
            ],
            "opaque_path_parameters": [
              "name"
            ],
            "path": [
              "/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}",
              "/repos/{owner}/{repo}/labels/{name}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.conversations \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "PATCH"
            ],
            "path": [
              "/repos/{owner}/{repo}/issues/comments/{comment_id}",
              "/repos/{owner}/{repo}/issues/{issue_number}",
              "/repos/{owner}/{repo}/milestones/{milestone_number}",
              "/repos/{owner}/{repo}/pulls/comments/{comment_id}",
              "/repos/{owner}/{repo}/pulls/{pull_number}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.conversations \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "PATCH"
            ],
            "opaque_path_parameters": [
              "name"
            ],
            "path": [
              "/repos/{owner}/{repo}/labels/{name}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.conversations \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/repos/{owner}/{repo}/issues",
              "/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions",
              "/repos/{owner}/{repo}/issues/{issue_number}/assignees",
              "/repos/{owner}/{repo}/issues/{issue_number}/comments",
              "/repos/{owner}/{repo}/issues/{issue_number}/labels",
              "/repos/{owner}/{repo}/issues/{issue_number}/reactions",
              "/repos/{owner}/{repo}/labels",
              "/repos/{owner}/{repo}/milestones",
              "/repos/{owner}/{repo}/pulls",
              "/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions",
              "/repos/{owner}/{repo}/pulls/{pull_number}/comments",
              "/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies",
              "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers",
              "/repos/{owner}/{repo}/pulls/{pull_number}/reviews",
              "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.conversations \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "PUT"
            ],
            "path": [
              "/repos/{owner}/{repo}/issues/{issue_number}/labels",
              "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ and (allows access.code \"read\") (allows access.conversations \"read\") }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/repos/{owner}/{repo}/commits/{commit_sha}/pulls",
              "/repos/{owner}/{repo}/events",
              "/repos/{owner}/{repo}/pulls/{pull_number}/commits",
              "/repos/{owner}/{repo}/pulls/{pull_number}/files",
              "/users/{username}/events",
              "/users/{username}/received_events"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ and (allows access.code \"write\") (allows access.conversations \"write\") }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "PUT"
            ],
            "path": [
              "/repos/{owner}/{repo}/pulls/{pull_number}/merge",
              "/repos/{owner}/{repo}/pulls/{pull_number}/update-branch"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.actions \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/repos/{owner}/{repo}/actions/artifacts",
              "/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}",
              "/repos/{owner}/{repo}/actions/jobs/{job_id}",
              "/repos/{owner}/{repo}/actions/jobs/{job_id}/logs",
              "/repos/{owner}/{repo}/actions/runs",
              "/repos/{owner}/{repo}/actions/runs/{run_id}",
              "/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts",
              "/repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
              "/repos/{owner}/{repo}/actions/runs/{run_id}/logs",
              "/repos/{owner}/{repo}/actions/workflows",
              "/repos/{owner}/{repo}/actions/workflows/{workflow_id}",
              "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
              "/repos/{owner}/{repo}/check-runs/{check_run_id}",
              "/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.actions \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "ref"
            ],
            "path": [
              "/repos/{owner}/{repo}/commits/{ref}/check-runs",
              "/repos/{owner}/{repo}/commits/{ref}/check-suites",
              "/repos/{owner}/{repo}/commits/{ref}/status",
              "/repos/{owner}/{repo}/commits/{ref}/statuses"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.actions \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/repos/{owner}/{repo}/actions/runs/{run_id}/cancel",
              "/repos/{owner}/{repo}/actions/runs/{run_id}/rerun",
              "/repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs",
              "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches",
              "/repos/{owner}/{repo}/statuses/{sha}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.gists \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/gists",
              "/gists/{gist_id}",
              "/users/{username}/gists"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.gists \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/gists"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.gists \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "DELETE",
              "PATCH"
            ],
            "path": [
              "/gists/{gist_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.stars \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/user/starred",
              "/users/{username}/starred"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.stars \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "DELETE",
              "PUT"
            ],
            "path": [
              "/user/starred/{owner}/{repo}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.organizations \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/orgs/{org}",
              "/orgs/{org}/members",
              "/orgs/{org}/teams",
              "/orgs/{org}/teams/{team_slug}/members",
              "/user/orgs"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.emails \"read\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/user/emails"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token || auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.repositories \"write\" }}",
          "match": {
            "host": [
              "api.github.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/orgs/{org}/repos",
              "/repos/{owner}/{repo}/forks",
              "/user/repos"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Authorization"
              ]
            }
          },
          "if": "{{ allows access.code \"read\" }}",
          "match": {
            "host": [
              "codeload.github.com",
              "release-assets.githubusercontent.com",
              "objects.githubusercontent.com",
              "objects-origin.githubusercontent.com",
              "github-releases.githubusercontent.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "*"
            ],
            "path": [
              "/*"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Authorization"
              ]
            }
          },
          "if": "{{ allows access.gists \"read\" }}",
          "match": {
            "host": [
              "gist.githubusercontent.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "*"
            ],
            "path": [
              "/*"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Authorization"
              ]
            }
          },
          "if": "{{ allows access.actions \"read\" }}",
          "match": {
            "host": [
              "*.actions.githubusercontent.com",
              "*.blob.core.windows.net"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "*"
            ],
            "path": [
              "/*"
            ],
            "protocol": "http"
          }
        }
      ]
    }
    
  • icon.svgicon.svg
  • README.md
    ---
    description: Work with GitHub repositories, issues, pull requests, releases and Actions.
    ---
    
    # GitHub
    
    Browse and search repositories, code, commits and branches; read files, diffs and
    CI results; follow issues, pull requests, reviews, releases, workflow runs and
    gists across your personal account and organizations; and catch up on recent
    activity and starred repositories.
    
    Each connection sets one access level per area:
    
    | Access | Read | Write |
    | --- | --- | --- |
    | **Code and releases** | Files, branches, commits, compare, archives, releases and their assets, code and commit search | Commit and delete files, git blobs, trees, commits and refs, merge and rename branches, sync forks, comment on commits, manage releases |
    | **Issues and pull requests** | Issues, pull requests, comments, reviews, labels, milestones, assignees and collaborators, issue search | Open, edit, close, comment, react, label, assign and review |
    | **Actions, checks and statuses** | Workflows, runs, jobs, logs, artifacts, check runs and suites, commit statuses | Dispatch, cancel and rerun workflows; set commit statuses |
    | **Gists** | Gists and their files | Create, edit and delete gists |
    | **Stars** | Starred repositories | Star and unstar |
    | **Organizations and teams** | Your organizations, their members and teams | |
    | **Email addresses** | Your email addresses, including private ones | |
    | **Create and fork repositories** | | Create repositories and forks |
    
    New connections read code, issues and pull requests, Actions and organizations.
    Pull request files, commits and diffs, the pull requests of a commit, and activity
    feeds also need Code read; merging a pull request or updating its branch needs
    Write on both Code and Issues and pull requests. Code write includes workflow
    files wherever GitHub grants the Workflows permission. Profiles, repository
    lists and metadata, and repository and user search are always available.
    
    GitHub's own permissions still apply: Houston only reaches repositories your
    account, token or app installation can access.
    
    Connect by signing in with GitHub, or with a personal access token. Archives, gist files,
    release assets and workflow logs are saved as session files. Repository deletion, settings,
    secrets, webhooks and administration are not available.
    
  • SETUP.md
    # Connect GitHub
    
    1. Choose a level for each access row and select **Continue with GitHub**.
    2. Authorize **OK Houston**, then [install or configure the app](https://github.com/apps/ok-houston)
       for the account/organization and repositories to share. An organization owner
       may need to approve it.
    
    With Connect with GitHub, Houston enforces the access rows. GitHub's screen lists
    the app's full permissions, which are the most any connection can reach; the rows
    you choose narrow them for this connection.
    
    > Access is also limited by your own GitHub permissions and the app's installations.
    > Change shared repositories under [Installed GitHub Apps](https://github.com/settings/installations)
    > without reconnecting.
    
    ## Advanced
    
    ### Personal access token
    
    Choose **Personal access token** in Houston, set the access rows, and follow
    **Create a token on GitHub**. The link opens a
    [fine-grained token](https://github.com/settings/personal-access-tokens/new) with
    the matching permissions filled in, so GitHub enforces them too:
    
    | Houston access | GitHub permission |
    | --- | --- |
    | Code and releases | **Contents** |
    | Issues and pull requests | **Issues**, **Pull requests** |
    | Actions, checks and statuses | **Actions**, **Commit statuses** |
    | Gists | **Gists**, which GitHub offers only as write: add it yourself for Gists **Write** |
    | Stars | **Starring** |
    | Organizations and teams | **Members** |
    | Email addresses | **Email addresses** |
    | Create and fork repositories | **Administration** |
    
    Select the token's owner and repositories before generating it. Metadata is
    automatic. A token belongs to one owner: a token you own cannot hold
    **Members**, and one an organization owns cannot hold **Gists**, **Starring** or
    **Email addresses**, so use one connection per owner. Code write includes workflow files only when you also grant
    **Workflows**. Creating repositories also needs GitHub's **Repository creation**
    permission. Check runs and suites need Connect with GitHub or a classic token.
    
    A [classic token](https://github.com/settings/tokens/new) instead needs `repo`,
    `workflow`, `read:org`, `gist` and `user:email`. It covers all your repositories
    and `repo` permits writes; Houston still enforces the access rows.
    
    ### Missing repositories or access
    
    Check installation/token repository selection, organization approval and SAML SSO
    (**Configure SSO** on the token). Replace expired/revoked tokens or reconnect a
    revoked app. Revoke app access in [Authorized GitHub Apps](https://github.com/settings/apps/authorizations).
    
  • tests
    • authentication.luau
      return {
      	contract = function(m)
      		m.authentication({
      			{
      				auth = {},
      				config = {},
      				endpoint = { "GET", "https://api.github.com/user" },
      				expected = "Bearer synthetic-oauth-token",
      				header = "Authorization",
      				method = "oauth",
      				oauth = true,
      				publisher = {
      					client_id = "synthetic-public-client",
      					client_secret = "synthetic-client-secret",
      				},
      			},
      			{
      				auth = { token = "synthetic-method-secret" },
      				config = {},
      				endpoint = { "GET", "https://api.github.com/user" },
      				expected = "Bearer synthetic-method-secret",
      				header = "Authorization",
      				method = "token",
      				publisher = {},
      			},
      		})
      	end,
      }
      
    • conversations_only.luau
      return {
      	scenario = {publisher = {}, access = {code = "none", conversations = "write", actions = "none", organizations = "none"}, config = {},
      		auth_method = "token", auth_config = {token = "fixture-token"}},
      	configure = function()
      		requests = {}
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader('{"number":3}')})
      		end}
      	end,
      	run = function(github)
      		assert(github.createIssue ~= nil and github.getContent == nil and github.listPullFiles == nil and github.mergePull == nil,
      			"issues and pull requests without code exported the wrong functions")
      		assert(github.getPull({owner = "o", repo = "r", pull_number = 3}).number == 3)
      		local ok, err = pcall(function() github.getPull({owner = "o", repo = "r", pull_number = 3, format = "diff"}) end)
      		assert(not ok and string.find(tostring(err), "format needs Code read access", 1, true), tostring(err))
      		assert(#requests == 1, "a pull request diff reached GitHub without Code access")
      	end,
      }
      
    • endpoints.luau
      return {
      	contract = function(m)
      		m.endpointRules()
      	end,
      }
      
    • errors.luau
      return {
      	scenario = {publisher = {}, access = {conversations = "write"}, config = {}, auth_method = "token", auth_config = {token = "fixture-token"}},
      	configure = function()
      		calls = 0
      		status = 200
      		payload = "{}"
      		responseHeaders = {}
      		http = {request = function(req)
      			calls += 1
      			return fixture.operation({statusCode = status, headers = responseHeaders, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(github)
      		local function upstream(code, body, headers, expected, absent)
      			status, payload, responseHeaders = code, body, headers
      			local before = calls
      			local ok, err = pcall(function() github.createIssueComment({owner = "o", repo = "r", issue_number = 1, body = "Hi"}) end)
      			assert(not ok and type(err) ~= "string", "lost the structured upstream error")
      			for _, text in expected do
      				assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err))
      			end
      			if absent then assert(not string.find(tostring(err), absent, 1, true), "unbounded error: " .. #tostring(err)) end
      			assert(calls == before + 1, "failed write was retried")
      		end
      		upstream(404, '{"message":"Not Found","documentation_url":"https://docs.github.com/rest/issues/comments#create-an-issue-comment","status":"404"}', {},
      			{"HTTP 404: Not Found", '"retryable":false', '"upstream_status":404'})
      		upstream(422, '{"message":"Validation Failed","errors":[{"resource":"IssueComment","code":"missing_field","field":"body"}],"status":"422"}', {},
      			{"HTTP 422: Validation Failed", "missing_field", "IssueComment", '"retryable":false'})
      		upstream(403, '{"message":"Resource not accessible by personal access token","status":"403"}', {["x-accepted-github-permissions"] = {"issues=write; pull_requests=write"}},
      			{"Resource not accessible", "needs permissions issues=write; pull_requests=write", '"retryable":false'})
      		upstream(403, '{"message":"API rate limit exceeded for user ID 1.","status":"403"}', {["x-ratelimit-remaining"] = {"0"}, ["x-ratelimit-reset"] = {"1792193237"}},
      			{"API rate limit exceeded", "rate limit resets at 1792193237", '"retryable":true'})
      		upstream(403, '{"message":"You have exceeded a secondary rate limit.","status":"403"}', {["retry-after"] = {"60"}},
      			{"secondary rate limit", "retry after 60s", '"retryable":true'})
      		upstream(307, '{"message":"Temporary Redirect","url":"https://api.github.com/repositories/1/issues/1/comments"}', {location = {"https://api.github.com/repositories/1/issues/1/comments"}},
      			{"HTTP 307", "renamed or transferred", '"retryable":false'})
      		upstream(301, '{"message":"Moved Permanently"}', {location = {"https://api.github.com/user/1"}}, {"HTTP 301"}, "renamed")
      		upstream(403, '{"message":"You have exceeded a secondary rate limit. Please wait a few minutes before you try again.","status":"403"}', {},
      			{"secondary rate limit", '"retryable":true'})
      		upstream(301, '{"message":"Moved Permanently"}', {location = {"https://api.github.com/repos/o/r/issues/9?token=x"}}, {"moved to /repos/o/r/issues/9"}, "token=x")
      		upstream(429, '{"message":"Too many requests"}', {}, {"HTTP 429", '"retryable":true'})
      		upstream(502, "<html>Bad gateway</html>", {}, {"HTTP 502", '"retryable":true'})
      		upstream(400, json.encode({message = string.rep("x", 5000)}), {}, {"HTTP 400", string.rep("x", 600)}, string.rep("x", 601))
      		upstream(422, json.encode({message = "Validation Failed", errors = {{code = string.rep("e", 5000)}}}), {["retry-after"] = {string.rep("9", 500)}},
      			{"Validation Failed", string.rep("e", 500)}, string.rep("e", 601))
      		upstream(403, '{"message":"slow down"}', {["retry-after"] = {string.rep("9", 500)}}, {"retry after " .. string.rep("9", 200) .. "s"}, string.rep("9", 201))
      		upstream(201, "<html>Maintenance</html>", {}, {"invalid JSON"})
      		upstream(201, "", {}, {"invalid JSON"})
      	end,
      }
      
    • files.luau
      return {
      	scenario = {publisher = {client_id = "Iv23liFixture", client_secret = "fixture-client-secret"}, access = {code = "write", conversations = "write", actions = "write", gists = "write", stars = "write", organizations = "read", emails = "read", repositories = "write"},
      		config = {}, auth_method = "oauth", auth_config = {}},
      	configure = function()
      		requests = {}
      		responses = {}
      		fs = fixture.files()
      		opened = {}
      		local open = fs.open
      		fs.open = function(path, mode)
      			local file = open(path, mode)
      			table.insert(opened, file)
      			return file
      		end
      		admissionFailure = false
      		http = {request = function(req)
      			if admissionFailure then error("HTTP admission failed") end
      			table.insert(requests, req)
      			local next = table.remove(responses, 1) or {statusCode = 200, headers = {}, body = "{}"}
      			return fixture.operation({statusCode = next.statusCode, headers = next.headers, body = fixture.reader(next.body)})
      		end}
      	end,
      	run = function(github)
      		local API = "https://api.github.com"
      		local function respond(statusCode, body, headers)
      			table.insert(responses, {statusCode = statusCode, body = body, headers = headers or {}})
      		end
      		local function redirect(location) respond(302, "", {location = {location}}) end
      		local function contents(path)
      			local file = fs.open(path, "r")
      			local chunk = await(file:read(1024 * 1024))
      			await(file:close())
      			return if chunk.done then "" else chunk.data
      		end
      		local function rejected(fn, expected)
      			local before = #requests
      			local ok, err = pcall(fn)
      			assert(not ok and string.find(tostring(err), expected, 1, true), "wrong error: " .. tostring(err))
      			return #requests - before
      		end
      
      		local names = {}
      		for name in github do if name ~= "help" then table.insert(names, name) end end
      		assert(#names == 159, "wrong surface for Connect with GitHub: " .. #names)
      
      		respond(200, "binary\0bytes")
      		local saved = github.getContent({owner = "o", repo = "r", path = "assets/logo.png", ref = "main", save_as = "logo.png"})
      		assert(requests[1].url == API .. "/repos/o/r/contents/assets%2Flogo.png?ref=main", requests[1].url)
      		assert(requests[1].headers.Accept[1] == "application/vnd.github.raw+json" and requests[1].headers.Authorization == nil)
      		assert(saved.path == "logo.png" and saved.size == 12 and type(saved.url) == "string" and contents("logo.png") == "binary\0bytes")
      
      		local signed = "https://codeload.github.com/o/r/legacy.tar.gz/refs/heads/feature/x?token=SIGNED"
      		redirect(signed)
      		respond(200, "tarball")
      		saved = github.downloadTarball({owner = "o", repo = "r", ref = "feature/x", save_as = "src.tar.gz"})
      		assert(requests[2].url == API .. "/repos/o/r/tarball/feature%2Fx" and requests[2].headers.Accept[1] == "application/vnd.github+json")
      		assert(requests[3].method == "GET" and requests[3].url == signed and requests[3].headers == nil)
      		assert(saved.size == 7 and contents("src.tar.gz") == "tarball")
      
      		respond(200, '{"id":5,"name":"app.zip","browser_download_url":"https://github.com/o/r/releases/download/v1/app.zip"}')
      		local asset = github.getReleaseAsset({owner = "o", repo = "r", asset_id = 5})
      		assert(asset.name == "app.zip" and requests[4].headers.Accept[1] == "application/vnd.github+json")
      		redirect("https://release-assets.githubusercontent.com/github-production-release-asset/1/abc?sig=SIGNED")
      		respond(200, "zip-bytes")
      		saved = github.getReleaseAsset({owner = "o", repo = "r", asset_id = 5, save_as = "dist/app.zip"})
      		assert(requests[5].url == API .. "/repos/o/r/releases/assets/5" and requests[5].headers.Accept[1] == "application/octet-stream")
      		assert(string.find(requests[6].url, "https://release-assets.githubusercontent.com/", 1, true) == 1 and contents("dist/app.zip") == "zip-bytes")
      
      		redirect("https://productionresultssa12.blob.core.windows.net/actions-results/job-logs.txt?sig=SIGNED")
      		respond(200, "2026-10-16T00:00:00Z ##[error]Process completed with exit code 1.\n")
      		github.downloadJobLogs({owner = "o", repo = "r", job_id = 399444496, save_as = "job.log"})
      		assert(requests[7].url == API .. "/repos/o/r/actions/jobs/399444496/logs")
      		assert(await(fs.grep("exit code 1", "job.log")).matches[1] ~= nil)
      		redirect("https://pipelinesghubeus6.actions.githubusercontent.com/logs.zip?sig=SIGNED")
      		respond(200, "zip")
      		github.downloadRunLogs({owner = "o", repo = "r", run_id = 30433642, save_as = "run-logs.zip"})
      		assert(requests[10].url == "https://pipelinesghubeus6.actions.githubusercontent.com/logs.zip?sig=SIGNED")
      
      		for _, location in {"https://evil.example/x", "https://productionresultssa1.blob.core.windows.net.evil.example/x",
      			"http://codeload.github.com/o/r",
      			"https://gist.githubusercontent.com/o/1/raw", "https://evil.actions.githubusercontent.com.example/x",
      			"https://evil.blob.core.windows.net/x", "https://a.b.actions.githubusercontent.com/x"} do
      			redirect(location)
      			local sentRequests = rejected(function() github.downloadZipball({owner = "o", repo = "r", ref = "main", save_as = "src.zip"}) end,
      				"redirected the download to an unexpected host")
      			assert(sentRequests == 1, "followed a redirect to " .. location)
      		end
      		respond(403, '{"message":"Must have admin rights to Repository.","status":"403"}')
      		assert(rejected(function() github.downloadRunLogs({owner = "o", repo = "r", run_id = 1, save_as = "x.zip"}) end,
      			"Must have admin rights") == 1)
      		redirect(signed)
      		respond(403, "<Error>AuthenticationFailed</Error>")
      		assert(rejected(function() github.downloadTarball({owner = "o", repo = "r", ref = "main", save_as = "y.tar.gz"}) end, "call again for a fresh link") == 2)
      		redirect(signed)
      		respond(403, "<Error>AuthenticationFailed</Error>")
      		local ok, err = pcall(function() github.downloadTarball({owner = "o", repo = "r", ref = "main", save_as = "y.tar.gz"}) end)
      		assert(not ok and string.find(tostring(err), '"retryable":true', 1, true) and not string.find(tostring(err), "SIGNED", 1, true), tostring(err))
      		redirect(signed)
      		respond(404, "<Error>BlobNotFound</Error>")
      		ok, err = pcall(function() github.downloadTarball({owner = "o", repo = "r", ref = "main", save_as = "y.tar.gz"}) end)
      		assert(not ok and string.find(tostring(err), '"retryable":false', 1, true), "a missing download is not retryable: " .. tostring(err))
      		respond(302, "", {location = json.decode("[]")})
      		assert(rejected(function() github.downloadTarball({owner = "o", repo = "r", ref = "main", save_as = "y.tar.gz"}) end, "GitHub HTTP 302") == 1)
      		assert(rejected(function() github.downloadTarball({owner = "o", repo = "r", ref = "main"}) end, "save_as is required") == 0)
      		for _, bad in {"../x.tar.gz", "/etc/x"} do
      			assert(rejected(function() github.downloadTarball({owner = "o", repo = "r", ref = "main", save_as = bad}) end, "") == 0, "invalid save_as reached GitHub")
      		end
      		assert(rejected(function() github.getRepo({owner = "o", repo = "r", save_as = "repo.json"}) end, "getRepo has no option save_as") == 0)
      
      		admissionFailure = true
      		assert(rejected(function() github.downloadTarball({owner = "o", repo = "r", ref = "main", save_as = "z.tar.gz"}) end, "HTTP admission failed") == 0)
      		assert(not pcall(function() opened[#opened]:write("x") end), "a failed download left its file open")
      		admissionFailure = false
      		respond(200, "blob\0raw")
      		github.getBlob({owner = "o", repo = "r", file_sha = "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", save_as = "blob.bin"})
      		assert(requests[#requests].headers.Accept[1] == "application/vnd.github.raw+json" and contents("blob.bin") == "blob\0raw")
      		respond(302, "", {location = {"https://CODELOAD.github.com/o/r/legacy.zip/refs/heads/main"}})
      		respond(200, "upper")
      		github.downloadZipball({owner = "o", repo = "r", ref = "main", save_as = "upper.zip"})
      		assert(contents("upper.zip") == "upper", "host names are case-insensitive")
      		for _, code in {301, 307} do
      			respond(code, "", {location = {signed}})
      			respond(200, "moved")
      			github.downloadZipball({owner = "o", repo = "r", ref = "main", save_as = "moved.zip"})
      			assert(requests[#requests].url == signed and contents("moved.zip") == "moved", "did not follow " .. code)
      		end
      		respond(301, '{"message":"Moved Permanently","url":"https://api.github.com/repositories/1/tarball/main"}', {location = {"https://api.github.com/repositories/1/tarball/main"}})
      		assert(rejected(function() github.downloadTarball({owner = "o", repo = "old", ref = "main", save_as = "old.tar.gz"}) end, "renamed or transferred") == 1)
      		redirect("https://api.github.com/repositories/1/tarball/main")
      		assert(rejected(function() github.downloadTarball({owner = "o", repo = "old", ref = "main", save_as = "old.tar.gz"}) end, "renamed or transferred") == 1)
      		respond(200, '[{"name":"a.md","download_url":"https://raw.githubusercontent.com/o/r/main/a.md?token=SIGNED"}]', {["content-type"] = {"application/json; charset=utf-8"}})
      		assert(rejected(function() github.getContent({owner = "o", repo = "r", path = "docs", save_as = "docs.bin"}) end, "directory or submodule") == 1)
      		assert(not await(fs.exists("docs.bin")), "a refused download created its session file")
      		respond(202, "")
      		assert(rejected(function() github.getContent({owner = "o", repo = "r", path = "a.bin", save_as = "a.bin"}) end, "GitHub HTTP 202") == 1)
      
      		local raw = "https://gist.githubusercontent.com/o/aa5a315d61ae9438b18d/raw/3a0f86fb/big%20data.json"
      		local function gist(files) respond(200, json.encode({id = "aa5a315d61ae9438b18d", files = files}), {["content-type"] = {"application/json; charset=utf-8"}}) end
      		gist({["big data.json"] = {filename = "big data.json", truncated = true, content = "{\"cut", raw_url = raw}})
      		respond(200, '{"whole":true}', {["content-type"] = {"text/plain; charset=utf-8"}})
      		saved = github.downloadGistFile({gist_id = "aa5a315d61ae9438b18d", filename = "big data.json", save_as = "big.json"})
      		assert(requests[#requests - 1].url == API .. "/gists/aa5a315d61ae9438b18d" and requests[#requests - 1].headers.Accept[1] == "application/vnd.github+json")
      		assert(requests[#requests].method == "GET" and requests[#requests].url == raw and requests[#requests].headers == nil)
      		assert(saved.path == "big.json" and saved.size == 14 and contents("big.json") == '{"whole":true}')
      		gist({["a.md"] = {filename = "a.md", raw_url = "https://gist.githubusercontent.com/o/1/raw/a.md"}})
      		assert(rejected(function() github.downloadGistFile({gist_id = "aa5a315d61ae9438b18d", filename = "b.md", save_as = "b.md"}) end, "no file named b.md") == 1)
      		gist({["a.md"] = {filename = "a.md", raw_url = "https://evil.example/o/1/raw/a.md"}})
      		assert(rejected(function() github.downloadGistFile({gist_id = "aa5a315d61ae9438b18d", filename = "a.md", save_as = "a.md"}) end, "no file named a.md") == 1)
      		gist({["a.md"] = {filename = "a.md", raw_url = "https://gist.githubusercontent.com/o/1/raw/a.md"}})
      		respond(404, "404: Not Found")
      		ok, err = pcall(function() github.downloadGistFile({gist_id = "aa5a315d61ae9438b18d", filename = "a.md", save_as = "a.md"}) end)
      		assert(not ok and string.find(tostring(err), "GitHub HTTP 404", 1, true) and string.find(tostring(err), '"retryable":false', 1, true), tostring(err))
      		for _, call in {{gist_id = "aa5a315d61ae9438b18d", save_as = "a.md"}, {gist_id = "aa5a315d61ae9438b18d", filename = "a.md"},
      			{gist_id = "aa5a315d61ae9438b18d", filename = "a.md", save_as = "../a.md"}, {gist_id = "aa5a315d61ae9438b18d", filename = "a.md", save_as = "a.md", ref = "x"},
      			{gist_id = "../x", filename = "a.md", save_as = "a.md"}} do
      			assert(rejected(function() github.downloadGistFile(call) end, "") == 0, "invalid downloadGistFile input reached GitHub")
      		end
      		assert(rejected(function() github.downloadGistFile({gist_id = "aa5a315d61ae9438b18d", filename = "a.md", save_as = "a.md", ref = "x"}) end,
      			"downloadGistFile has no option ref") == 0)
      	end,
      }
      
    • hosts.luau
      return {
      	contract = function(m)
      		local source = m.modules["connector.luau"]
      		local set = assert(
      			string.match(source, "local OPAQUE = table.freeze%(%{([^}]*)%}%)"),
      			"missing opaque parameter set"
      		)
      		local opaque = {}
      		for name in string.gmatch(set, "([%w_]+) = true") do
      			opaque[name] = true
      		end
      		local want, got, free = {}, {}, {}
      		for _, entry in m.endpoints() do
      			local names = {}
      			for name in string.gmatch(entry.path, "{([%w_]+)}") do
      				if opaque[name] then
      					table.insert(names, name)
      				end
      			end
      			table.sort(names)
      			table.insert(
      				want,
      				entry.method .. " api.github.com " .. entry.path .. " " .. table.concat(names, ",")
      			)
      		end
      		for _, rule in m.raw.proxy do
      			if not rule.action.headers.set or not rule.action.headers.set.Authorization then
      				table.insert(free, rule)
      				continue
      			end
      			local names = m.concat(rule.match.opaque_path_parameters or {})
      			table.sort(names)
      			for _, host in rule.match.host do
      				for _, method in rule.match.method do
      					for _, path in rule.match.path do
      						table.insert(
      							got,
      							method .. " " .. host .. " " .. path .. " " .. table.concat(names, ",")
      						)
      					end
      				end
      			end
      		end
      		m.sortedEqual(want, got)
      		-- Each download host travels without credentials and only with the row it serves.
      		local downloads = {
      			[m.accessGate("code:read")] = {
      				"codeload.github.com",
      				"release-assets.githubusercontent.com",
      				"objects.githubusercontent.com",
      				"objects-origin.githubusercontent.com",
      				"github-releases.githubusercontent.com",
      			},
      			[m.accessGate("gists:read")] = { "gist.githubusercontent.com" },
      			[m.accessGate("actions:read")] = { "*.actions.githubusercontent.com", "*.blob.core.windows.net" },
      		}
      		assert(#free == m.count(downloads), "download rules changed")
      		for _, rule in free do
      			assert(
      				m.equal(rule.match.host, downloads[rule["if"]])
      					and m.equal(rule.match.method, { "GET" })
      					and m.equal(rule.action.headers.remove, { "Authorization" }),
      				"download rule credentials, hosts or access changed"
      			)
      		end
      	end,
      }
      
    • manifest.luau
      return {
      	contract = function(m)
      		local api = "https://api.github.com"
      		local publisher = { client_id = "Iv23liFixture", client_secret = "fixture-client-secret" }
      		local rank, top = {}, {}
      		for _, row in m.raw.access do
      			rank[row.name] = {}
      			for index, level in row.levels do
      				rank[row.name][level.value] = index
      			end
      			top[row.name] = row.levels[#row.levels].value
      		end
      		local function allows(access, needs)
      			for row, level in needs do
      				if rank[row][access[row]] < rank[row][level] then
      					return false
      				end
      			end
      			return true
      		end
      		local function matrix(levels)
      			local access = {}
      			for row in rank do
      				access[row] = levels[row] or "none"
      			end
      			return access
      		end
      		-- Each group names the access it needs; routes are relative to the API unless absolute.
      		local groups = {
      			{ needs = {}, routes = {
      				"GET /user",
      				"GET /users/octocat",
      				"GET /user/repos",
      				"GET /repos/o/r",
      				"GET /repos/o/r/languages",
      				"GET /repos/o/r/stargazers",
      				"GET /rate_limit",
      				"GET /search/repositories?q=x",
      			} },
      			{ needs = { code = "read" }, routes = {
      				"GET /repos/o/r/branches/feature%2Fx",
      				"GET /repos/o/r/contents/src%2Fmain.go?ref=release%2F1",
      				"GET /repos/o/r/contents/test%2Ffolder%2525with%20percentage%23%2Findex.js",
      				"GET /repos/o/r/branches/fix%2F100%25",
      				"GET /repos/o/r/compare/main...feature%2Fx",
      				"GET /repos/o/r/git/ref/heads%2Ffeature%2Fx",
      				"GET /repos/o/r/git/trees/feature%2Fx",
      				"GET /repos/o/r/releases/tags/app%2Fv1",
      				"GET /repos/o/r/tarball/main",
      				"GET /repos/o/r/tags",
      				"GET /search/code?q=x",
      				"GET /search/commits?q=x",
      			} },
      			{ needs = { code = "write" }, routes = {
      				"PUT /repos/o/r/contents/docs%2Fa.md",
      				"DELETE /repos/o/r/contents/docs%2Fa.md",
      				"PATCH /repos/o/r/git/refs/heads%2Fx",
      				"DELETE /repos/o/r/git/refs/heads%2Fx",
      				"POST /repos/o/r/branches/old%2Fname/rename",
      				"POST /repos/o/r/commits/c1/comments",
      				"POST /repos/o/r/merges",
      				"POST /repos/o/r/releases",
      			} },
      			{ needs = { conversations = "read" }, routes = {
      				"GET /issues",
      				"GET /repos/o/r/issues?state=open",
      				"GET /repos/o/r/pulls/1",
      				"GET /repos/o/r/pulls/comments/1",
      				"GET /repos/o/r/collaborators",
      				"GET /search/issues?q=x",
      			} },
      			{ needs = { conversations = "write" }, routes = {
      				"POST /repos/o/r/issues",
      				"PATCH /repos/o/r/pulls/1",
      				"PATCH /repos/o/r/pulls/comments/1",
      				"DELETE /repos/o/r/issues/1/labels/area%2Fui",
      				"DELETE /repos/o/r/issues/1/labels/50%25%20done",
      				"PATCH /repos/o/r/labels/100%25",
      				"POST /repos/o/r/pulls/1/reviews",
      			} },
      			{ needs = { code = "read", conversations = "read" }, routes = {
      				"GET /users/octocat/events",
      				"GET /users/octocat/received_events",
      				"GET /repos/o/r/events",
      				"GET /repos/o/r/pulls/1/files",
      				"GET /repos/o/r/pulls/1/commits",
      				"GET /repos/o/r/commits/c1/pulls",
      			} },
      			{ needs = { code = "write", conversations = "write" }, routes = {
      				"PUT /repos/o/r/pulls/1/merge",
      				"PUT /repos/o/r/pulls/1/update-branch",
      			} },
      			{ needs = { actions = "read" }, routes = {
      				"GET /repos/o/r/commits/feature%2Fx/check-runs",
      				"GET /repos/o/r/commits/main/status",
      				"GET /repos/o/r/actions/runs",
      				"GET /repos/o/r/actions/jobs/1/logs",
      			} },
      			{ needs = { actions = "write" }, routes = {
      				"POST /repos/o/r/actions/runs/1/cancel",
      				"POST /repos/o/r/actions/workflows/ci.yml/dispatches",
      				"POST /repos/o/r/statuses/c1",
      			} },
      			{ needs = { gists = "read" }, routes = { "GET /gists", "GET /gists/abc", "GET /users/octocat/gists" } },
      			{ needs = { gists = "write" }, routes = { "POST /gists", "PATCH /gists/abc", "DELETE /gists/abc" } },
      			{ needs = { stars = "read" }, routes = { "GET /user/starred?sort=updated", "GET /users/octocat/starred" } },
      			{ needs = { stars = "write" }, routes = { "PUT /user/starred/o/r", "DELETE /user/starred/o/r" } },
      			{ needs = { organizations = "read" }, routes = { "GET /user/orgs", "GET /orgs/acme", "GET /orgs/acme/teams" } },
      			{ needs = { emails = "read" }, routes = { "GET /user/emails" } },
      			{ needs = { repositories = "write" }, routes = {
      				"POST /user/repos",
      				"POST /orgs/acme/repos",
      				"POST /repos/o/r/forks",
      			} },
      		}
      		-- Signed downloads are fetched without credentials, each host only with its row.
      		local downloads = {
      			{ needs = { code = "read" }, urls = {
      				"https://codeload.github.com/o/r/legacy.tar.gz/refs/heads/feature/x?token=SIGNED",
      				"https://release-assets.githubusercontent.com/github-production-release-asset/1/abc?sig=SIGNED",
      				"https://objects.githubusercontent.com/github-production-release-asset-2e65be/1?sig=SIGNED",
      				"https://github-releases.githubusercontent.com/1/abc?sig=SIGNED",
      			} },
      			{ needs = { gists = "read" }, urls = {
      				"https://gist.githubusercontent.com/o/aa5a315d61ae9438b18d/raw/3a0f86fb/big%20data.json",
      			} },
      			{ needs = { actions = "read" }, urls = {
      				"https://productionresultssa12.blob.core.windows.net/actions-results/a/logs.txt?sig=SIGNED",
      				"https://pipelinesghubeus6.actions.githubusercontent.com/x/logs.zip?sig=SIGNED",
      			} },
      		}
      		-- Exported functions by the access they need; the first group is every base function.
      		local functions = {
      			{ needs = {}, names = {
      				"getAuthenticatedUser", "getUser", "getRateLimit", "listMyRepos", "listUserRepos", "listOrgRepos", "getRepo",
      				"listForks", "listLanguages", "getTopics", "listStargazers", "listContributors", "searchRepos", "searchUsers",
      			} },
      			{ needs = {}, method = "oauth", names = { "listInstallations", "listInstallationRepos" } },
      			{ needs = { code = "read" }, names = {
      				"getContent", "getTree", "getBlob", "downloadTarball", "listTags", "listCommitComments", "listReleases",
      				"getReleaseAsset", "searchCode", "searchCommits",
      			} },
      			{ needs = { code = "write" }, names = {
      				"putFile", "deleteFile", "createRef", "createBlob", "mergeBranch", "createCommitComment", "createRelease",
      				"generateReleaseNotes",
      			} },
      			{ needs = { conversations = "read" }, names = {
      				"listMyIssues", "getIssue", "getPull", "listPullReviews", "listCollaborators", "searchIssues",
      			} },
      			{ needs = { conversations = "write" }, names = {
      				"createIssue", "updatePull", "createPullReview", "setLabels", "createMilestone", "createIssueCommentReaction",
      			} },
      			{ needs = { code = "read", conversations = "read" }, names = {
      				"listUserEvents", "listReceivedEvents", "listRepoEvents", "listPullFiles", "listPullCommits", "listPullsForCommit",
      			} },
      			{ needs = { code = "write", conversations = "write" }, names = { "mergePull", "updatePullBranch" } },
      			{ needs = { actions = "read" }, names = { "listWorkflowRuns", "downloadJobLogs", "listCheckRuns", "getCombinedStatus" } },
      			{ needs = { actions = "write" }, names = { "dispatchWorkflow", "cancelWorkflowRun", "createCommitStatus" } },
      			{ needs = { gists = "read" }, names = { "listGists", "getGist", "downloadGistFile" } },
      			{ needs = { gists = "write" }, names = { "createGist", "updateGist", "deleteGist" } },
      			{ needs = { stars = "read" }, names = { "listMyStarred", "listUserStarred" } },
      			{ needs = { stars = "write" }, names = { "starRepo", "unstarRepo" } },
      			{ needs = { organizations = "read" }, names = { "listMyOrgs", "getOrg", "listOrgMembers", "listTeamMembers" } },
      			{ needs = { emails = "read" }, names = { "listEmails" } },
      			{ needs = { repositories = "write" }, names = { "createRepo", "createOrgRepo", "createFork" } },
      		}
      		local function checkExports(method, access, levels)
      			local result, err = m.exports({}, method, {}, nil, access)
      			assert(result and not err and result.type == "result", tostring(err))
      			local exported, base = {}, {}
      			for _, name in result.exports do
      				exported[name] = true
      			end
      			for _, group in functions do
      				local enabled = allows(access, group.needs) and (group.method == nil or group.method == method)
      				for _, name in group.names do
      					assert((exported[name] == true) == enabled, method .. " " .. name .. " export does not follow access")
      					if enabled and next(group.needs) == nil then
      						table.insert(base, name)
      					end
      				end
      			end
      			if next(levels) == nil then
      				m.sortedEqual(base, result.exports)
      			elseif levels == top then
      				assert(#result.exports == #m.endpoints() + 1 - (if method == "token" then 2 else 0), "full access omits functions")
      			end
      			local documented = {}
      			for name in string.gmatch("\n" .. result.help, "\n([^%s%(]+)%(") do
      				table.insert(documented, name)
      			end
      			m.sortedEqual(documented, m.concat(result.exports))
      		end
      		local matrices = {
      			{},
      			{ code = "read", conversations = "read" },
      			{ code = "write", conversations = "read" },
      			{ code = "read", conversations = "write" },
      			{ code = "write", conversations = "write" },
      			top,
      		}
      		for _, row in m.raw.access do
      			for index = 2, #row.levels do
      				table.insert(matrices, { [row.name] = row.levels[index].value })
      			end
      		end
      		for _, method in { "oauth", "token" } do
      			for _, levels in matrices do
      				local access = matrix(levels)
      				local r, err = m.resolve(publisher, {}, if method == "token" then { token = "fixture-token" } else nil, method, access)
      				assert(not err, tostring(err))
      				if m.count(r.Scopes) ~= 0 then
      					m.fail("GitHub App sign-in requests no scopes, got %s", r.Scopes)
      				end
      				if method == "oauth" then
      					r.Context.Auth[method].access_token = "fixture-token"
      				end
      				checkExports(method, access, levels)
      				for _, group in groups do
      					local routes = {}
      					for _, route in group.routes do
      						table.insert(routes, (string.gsub(route, " /", " " .. api .. "/", 1)))
      					end
      					m.routes(r, "Bearer fixture-token", allows(access, group.needs), routes)
      				end
      				for _, group in downloads do
      					for _, url in group.urls do
      						local recipe, problem = m.recipe(r, "GET", url, nil)
      						if not allows(access, group.needs) then
      							assert(problem ~= nil, "download host reached without its access: " .. url)
      							continue
      						end
      						assert(problem == nil, url .. ": " .. tostring(problem))
      						local headers, prepareError = m.prepare(recipe, r.Context, { Authorization = { "forged" } })
      						if prepareError ~= nil or m.header(headers, "Authorization") ~= "" then
      							m.fail("signed download %s kept credentials: %s %s", url, headers, prepareError)
      						end
      					end
      				end
      				m.routes(r, "Bearer fixture-token", false, {
      					"DELETE " .. api .. "/repos/o/r",
      					"PATCH " .. api .. "/repos/o/r",
      					"POST " .. api .. "/graphql",
      					"GET " .. api .. "/repos/o/r/actions/secrets",
      					"GET " .. api .. "/repos/o/r/actions/secrets/public-key",
      					"GET " .. api .. "/repos/o/r/hooks",
      					"GET " .. api .. "/repos/o/r/keys",
      					"PUT " .. api .. "/repos/o/r/collaborators/u",
      					"POST " .. api .. "/applications/abc/token",
      					"DELETE " .. api .. "/installation/token",
      					"POST " .. api .. "/credentials/revoke",
      					"GET " .. api .. "/authorizations",
      					"POST https://github.com/login/oauth/access_token",
      					"GET https://api.github.com.evil.test/user",
      					"GET " .. api .. "/repos/o/r/contents/%2e%2e%2fsecrets",
      					"GET " .. api .. "/repos/o/r/branches/a%2F..%2F..%2Fhooks",
      					"GET " .. api .. "/repos/o/r/issues/1%2F..%2F2",
      					"GET " .. api .. "/repos/o/r/contents/%252e%252e%252fsecrets",
      					"POST " .. api .. "/repos/o/r/branches/a/protection",
      					"PATCH " .. api .. "/repos/o/r/issues/1/labels/x",
      					"GET " .. api .. "/repos/o/r/git/refs/heads",
      					"GET https://uploads.github.com/repos/o/r/releases/1/assets",
      					"POST https://uploads.github.com/repos/o/r/releases/1/assets?name=a.zip",
      					"POST https://codeload.github.com/o/r/legacy.tar.gz/main",
      				})
      			end
      		end
      	end,
      }
      
    • oauth_read_only.luau
      return {
      	scenario = {publisher = {client_id = "Iv23liFixture", client_secret = "fixture-client-secret"}, config = {}, auth_method = "oauth", auth_config = {}},
      	configure = function()
      		requests = {}
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = 200, headers = {},
      				body = fixture.reader('{"total_count":1,"installations":[{"id":7,"account":{"login":"octo-org"}}]}')})
      		end}
      	end,
      	run = function(github)
      		local names = {}
      		for name in github do if name ~= "help" then table.insert(names, name) end end
      		assert(#names == 89, "wrong default surface for Connect with GitHub: " .. #names)
      		assert(github.createIssue == nil and github.listEmails == nil)
      		local installations = github.listInstallations({per_page = 100})
      		assert(requests[1].method == "GET" and requests[1].url == "https://api.github.com/user/installations?per_page=100")
      		assert(requests[1].headers.Authorization == nil and installations.installations[1].account.login == "octo-org")
      	end,
      }
      
    • read_only.luau
      return {
      	scenario = {publisher = {}, access = {gists = "read", stars = "read", emails = "read"}, config = {}, auth_method = "token", auth_config = {token = "fixture-token"}},
      	configure = function()
      		requests = {}
      		payload = "{}"
      		status = 200
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = status, headers = {}, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(github)
      		local API = "https://api.github.com"
      		local NULL = json.decode("null")
      		local function last() return requests[#requests] end
      		local function rejected(fn, expected)
      			local before = #requests
      			local ok, err = pcall(fn)
      			assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err))
      			assert(#requests == before, "invalid input reached GitHub")
      		end
      
      		local names = {}
      		for name in github do if name ~= "help" then table.insert(names, name) end end
      		assert(#names == 94, "wrong read-only surface: " .. #names)
      		for _, name in names do
      			assert(string.match(name, "^get") or string.match(name, "^list") or string.match(name, "^search") or string.match(name, "^compare") or string.match(name, "^download"), "read-only exports a write: " .. name)
      		end
      		for _, name in {"createIssue", "updateIssue", "createIssueComment", "createPull", "mergePull", "putFile", "deleteFile", "createRef",
      			"deleteRef", "createRelease", "dispatchWorkflow", "cancelWorkflowRun", "createGist", "updateRepo",
      			"generateReleaseNotes", "removeAssignees", "starRepo", "unstarRepo", "createCommitComment", "createIssueCommentReaction",
      			"updatePullReviewComment", "deletePullReviewComment", "createPullReviewCommentReaction", "listIssuesAssigned"} do
      			assert(github[name] == nil, "read-only leaked " .. name)
      		end
      		assert(github.listInstallations == nil, "installation lists need Connect with GitHub")
      		assert(#requests == 0, "initialization reached GitHub")
      
      		payload = '{"login":"octocat","id":1,"name":null}'
      		local me = github.getAuthenticatedUser()
      		local req = last()
      		assert(req.method == "GET" and req.url == API .. "/user" and req.body == nil)
      		assert(req.headers.Accept[1] == "application/vnd.github+json" and req.headers["X-GitHub-Api-Version"][1] == "2026-03-10")
      		assert(req.headers["User-Agent"] == nil and req.headers.Authorization == nil, "the transport sets User-Agent and the proxy injects credentials")
      		assert(me.login == "octocat" and me.name == NULL)
      
      		payload = '[{"number":7,"title":"Bug","labels":[],"pull_request":{"url":"x"}}]'
      		local opts = {owner = "octo-org", repo = "app.js", state = "all", labels = "bug,ui", per_page = 50, page = 2}
      		local issues = github.listIssues(opts)
      		assert(last().url == API .. "/repos/octo-org/app.js/issues?state=all&labels=bug%2Cui&per_page=50&page=2", last().url)
      		assert(opts.owner == "octo-org" and opts.per_page == 50, "caller options were modified")
      		assert(#issues == 1 and issues[1].number == 7 and json.encode(issues[1].labels) == "[]")
      
      		status, payload = 204, ""
      		assert(json.encode(github.listContributors({owner = "o", repo = "empty"})) == "[]", "an empty 204 list is an array")
      		status = 200
      		payload = '[{"full_name":"o/secret","private":true,"temp_clone_token":"AABBCC"}]'
      		local repos = github.listMyRepos({visibility = "private"})
      		assert(repos[1].full_name == "o/secret" and repos[1].temp_clone_token == nil, "a temporary clone token leaked")
      		payload = "[]"
      		local empty = github.listPulls({owner = "o", repo = "r"})
      		assert(last().url == API .. "/repos/o/r/pulls" and json.encode(empty) == "[]")
      
      		payload = '{"total_count":1,"incomplete_results":false,"items":[{"number":1}]}'
      		local found = github.searchIssues({q = "repo:o/r is:pr is:open review-requested:@me"})
      		assert(last().url == API .. "/search/issues?q=repo%3Ao%2Fr%20is%3Apr%20is%3Aopen%20review-requested%3A%40me", last().url)
      		assert(found.total_count == 1 and found.items[1].number == 1)
      		payload = '{"total_count":0,"incomplete_results":false,"items":[]}'
      		assert(json.encode(github.searchCode({q = "fetchUser"}).items) == "[]")
      
      		payload = "[]"
      		assert(json.encode(github.listMyIssues({filter = "created", state = "open"})) == "[]")
      		assert(last().url == API .. "/issues?filter=created&state=open", last().url)
      		payload = '[{"id":"1","type":"PushEvent","repo":{"name":"o/r"}}]'
      		assert(github.listUserEvents({username = "octocat", per_page = 100})[1].type == "PushEvent")
      		assert(last().url == API .. "/users/octocat/events?per_page=100", last().url)
      		github.listReceivedEvents({username = "octocat"})
      		assert(last().url == API .. "/users/octocat/received_events")
      		github.listRepoEvents({owner = "o", repo = "r", page = 2})
      		assert(last().url == API .. "/repos/o/r/events?page=2")
      		payload = "[]"
      		assert(json.encode(github.listMyStarred({sort = "updated", direction = "desc"})) == "[]")
      		assert(last().url == API .. "/user/starred?sort=updated&direction=desc", last().url)
      		github.listUserStarred({username = "octocat"})
      		assert(last().url == API .. "/users/octocat/starred")
      		assert(json.encode(github.listStargazers({owner = "o", repo = "r"})) == "[]" and last().url == API .. "/repos/o/r/stargazers")
      		github.listCommitComments({owner = "o", repo = "r", commit_sha = "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"})
      		assert(last().url == API .. "/repos/o/r/commits/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15/comments")
      		payload = '{"id":77,"body":"Nice"}'
      		assert(github.getIssueComment({owner = "o", repo = "r", comment_id = 77}).body == "Nice")
      		assert(last().url == API .. "/repos/o/r/issues/comments/77")
      		github.getPullReviewComment({owner = "o", repo = "r", comment_id = "78"})
      		assert(last().url == API .. "/repos/o/r/pulls/comments/78")
      		github.getPullReview({owner = "o", repo = "r", pull_number = 5, review_id = 9})
      		assert(last().url == API .. "/repos/o/r/pulls/5/reviews/9")
      		rejected(function() github.getPullReview({owner = "o", repo = "r", pull_number = 5}) end, "review_id must be a positive integer")
      		rejected(function() github.listCommitComments({owner = "o", repo = "r", commit_sha = "a/b"}) end, "commit_sha must be a GitHub name or SHA")
      		rejected(function() github.listUserEvents({username = "octocat", since = "2026-10-01"}) end, "listUserEvents has no option since")
      
      		payload = '[{"name":"a.md","download_url":"https://raw.githubusercontent.com/o/r/main/a.md?token=SIGNED"},{"name":"b","download_url":null}]'
      		local listing = github.getContent({owner = "o", repo = "r", path = "docs"})
      		assert(listing[1].download_url == "https://raw.githubusercontent.com/o/r/main/a.md" and listing[2].download_url == NULL, "signed download_url leaked")
      		payload = '{"name":"README.md","download_url":"https://raw.githubusercontent.com/o/r/main/README.md?token=SIGNED","_links":{"self":"x"}}'
      		assert(github.getReadme({owner = "o", repo = "r"}).download_url == "https://raw.githubusercontent.com/o/r/main/README.md")
      		payload = '{"name":"feature/x"}'
      		github.getBranch({owner = "o", repo = "r", branch = "feature/x"})
      		assert(last().url == API .. "/repos/o/r/branches/feature%2Fx", last().url)
      		github.getContent({owner = "o", repo = "r", path = "src/main file.go", ref = "release/1.0"})
      		assert(last().url == API .. "/repos/o/r/contents/src%2Fmain%20file.go?ref=release%2F1.0", last().url)
      		-- GitHub decodes a path once: nodejs/node has test/fixtures/es-modules/folder%25with percentage#/index.js.
      		github.getContent({owner = "o", repo = "r", path = "test/folder%25with percentage#/index.js"})
      		assert(last().url == API .. "/repos/o/r/contents/test%2Ffolder%2525with%20percentage%23%2Findex.js", last().url)
      		github.getBranch({owner = "o", repo = "r", branch = "fix/100%"})
      		assert(last().url == API .. "/repos/o/r/branches/fix%2F100%25", last().url)
      		github.getRef({owner = "o", repo = "r", ref = "heads/feature/x"})
      		assert(last().url == API .. "/repos/o/r/git/ref/heads%2Ffeature%2Fx")
      		github.getCombinedStatus({owner = "o", repo = "r", ref = "feature/x"})
      		assert(last().url == API .. "/repos/o/r/commits/feature%2Fx/status")
      		github.compareCommits({owner = "o", repo = "r", basehead = "main...feature/x"})
      		assert(last().url == API .. "/repos/o/r/compare/main...feature%2Fx")
      		github.getReleaseByTag({owner = "o", repo = "r", tag = "app/v1.2"})
      		assert(last().url == API .. "/repos/o/r/releases/tags/app%2Fv1.2")
      		github.getIssue({owner = "o", repo = "r", issue_number = "42"})
      		assert(last().url == API .. "/repos/o/r/issues/42")
      		github.getWorkflow({owner = "o", repo = "r", workflow_id = "ci.yml"})
      		assert(last().url == API .. "/repos/o/r/actions/workflows/ci.yml")
      		github.listRunsForWorkflow({owner = "o", repo = "r", workflow_id = 161335, status = "failure"})
      		assert(last().url == API .. "/repos/o/r/actions/workflows/161335/runs?status=failure", last().url)
      		github.getTree({owner = "o", repo = "r", tree_sha = "main", recursive = true})
      		assert(last().url == API .. "/repos/o/r/git/trees/main?recursive=true")
      		github.getTree({owner = "o", repo = "r", tree_sha = "main", recursive = false})
      		assert(last().url == API .. "/repos/o/r/git/trees/main", "GitHub treats any recursive value as true: " .. last().url)
      		github.getTree({owner = "o", repo = "r", tree_sha = "feature/x"})
      		rejected(function() github.getTree({owner = "o", repo = "r", tree_sha = "main", recursive = "false"}) end, "recursive must be true or false")
      		assert(last().url == API .. "/repos/o/r/git/trees/feature%2Fx", last().url)
      
      		payload = "diff --git a/x b/x\n+line\n"
      		local diff = github.getPull({owner = "o", repo = "r", pull_number = 3, format = "diff"})
      		assert(diff == payload and last().headers.Accept[1] == "application/vnd.github.diff")
      		assert(last().url == API .. "/repos/o/r/pulls/3")
      		github.getCommit({owner = "o", repo = "r", ref = "abc123", format = "patch"})
      		assert(last().headers.Accept[1] == "application/vnd.github.patch")
      
      		payload = "<html>oops</html>"
      		local ok, err = pcall(function() github.getRepo({owner = "o", repo = "r"}) end)
      		assert(not ok and string.find(tostring(err), "invalid JSON", 1, true), tostring(err))
      
      		rejected(function() github.getRepo({owner = "o"}) end, "repo must be a GitHub name or SHA")
      		rejected(function() github.getRepo({owner = "o", repo = ".."}) end, "repo must be a GitHub name or SHA")
      		rejected(function() github.getRepo({owner = "a/b", repo = "r"}) end, "owner must be a GitHub name or SHA")
      		rejected(function() github.getWorkflow({owner = "o", repo = "r", workflow_id = 1.5}) end, "workflow_id must be a GitHub name or SHA")
      		rejected(function() github.getIssue({owner = "o", repo = "r", issue_number = 1.5}) end, "issue_number must be a positive integer")
      		rejected(function() github.getIssue({owner = "o", repo = "r", issue_number = "1/../2"}) end, "issue_number must be a positive integer")
      		rejected(function() github.getIssue({owner = "o", repo = "r", issue_number = 0}) end, "issue_number must be a positive integer")
      		rejected(function() github.getContent({owner = "o", repo = "r", path = "../secrets"}) end, "path must be slash-separated names")
      		rejected(function() github.getContent({owner = "o", repo = "r", path = "a//b"}) end, "path must be slash-separated names")
      		rejected(function() github.getContent({owner = "o", repo = "r", path = "a\\..\\b"}) end, "path must be slash-separated names")
      		rejected(function() github.getContent({owner = "o", repo = "r", path = "a/./b"}) end, "path must be slash-separated names")
      		rejected(function() github.getContent({owner = "o", repo = "r", path = "%2e%2e/x"}) end, "path must be slash-separated names")
      		for _, escaped in {"a%2Fb", "a%5cb", "%252e%252e/x", "x/%25252E", "x%2500"} do
      			rejected(function() github.getContent({owner = "o", repo = "r", path = escaped}) end, "path must be slash-separated names")
      		end
      		rejected(function() github.getContent({owner = "o", repo = "r", path = "/etc"}) end, "path must be slash-separated names")
      		rejected(function() github.getContent({owner = "o", repo = "r", path = "a/\u{FF0E}\u{FF0E}/x"}) end, "path must be slash-separated names")
      		rejected(function() github.getContent({owner = "o", repo = "r", path = ""}) end, "path must be a nonempty string")
      		rejected(function() github.getBranch({owner = "o", repo = "r", branch = "a\nb"}) end, "branch must be a nonempty string without control characters")
      		rejected(function() github.searchIssues({}) end, "q is required")
      		rejected(function() github.searchIssues({q = NULL}) end, "q is required")
      		payload = "[]"
      		github.listIssueTimeline({owner = "o", repo = "r", issue_number = 1, exclude = "reactions"})
      		assert(last().url == API .. "/repos/o/r/issues/1/timeline?exclude=reactions")
      		rejected(function() github.listIssues({owner = "o", repo = "r", stat = "open"}) end, "listIssues has no option stat")
      		rejected(function() github.listIssues({owner = "o", repo = "r", labels = {"bug"}}) end, "labels must be a string, boolean or number")
      		rejected(function() github.getPull({owner = "o", repo = "r", pull_number = 1, format = "html"}) end, "format must be 'diff' or 'patch'")
      		rejected(function() github.getRepo({owner = "o", repo = "r", format = "diff"}) end, "getRepo has no option format")
      		rejected(function() github.getRepo("o/r") end, "opts must be an object")
      		rejected(function() github.getWorkflow({owner = "o", repo = "r", workflow_id = true}) end, "workflow_id must be a GitHub name or SHA")
      		rejected(function() github.getIssue({owner = "o", repo = "r", issue_number = 2 ^ 53}) end, "issue_number must be a positive integer")
      		rejected(function() github.getReadme({owner = "o", repo = "r", ref = {"main"}}) end, "ref must be a string")
      		payload = "{}"
      		github.getReadme({owner = "o", repo = "r", ref = "v1.0"})
      		assert(last().url == API .. "/repos/o/r/readme?ref=v1.0")
      		payload = "diff"
      		assert(github.compareCommits({owner = "o", repo = "r", basehead = "a...b", format = "diff"}) == "diff" and last().headers.Accept[1] == "application/vnd.github.diff")
      	end,
      }
      
    • writes.luau
      return {
      	scenario = {publisher = {}, access = {code = "write", conversations = "write", actions = "write", gists = "write", stars = "write", organizations = "read", emails = "read", repositories = "write"},
      		config = {}, auth_method = "token", auth_config = {token = "fixture-token"}},
      	configure = function()
      		requests = {}
      		fs = fixture.files()
      		payload = "{}"
      		status = 200
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = status, headers = {}, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(github)
      		local API = "https://api.github.com"
      		local NULL = json.decode("null")
      		local function last() return requests[#requests] end
      		local function same(a, b)
      			if type(a) ~= "table" or type(b) ~= "table" then return a == b end
      			for key, value in a do if not same(value, b[key]) then return false end end
      			for key in b do if a[key] == nil then return false end end
      			return true
      		end
      		local function sent(method, url, body)
      			local req = last()
      			if req.body ~= nil and type(req.body) ~= "string" then req.body = await(req.body:readAll(16 * 1024 * 1024)) end
      			assert(req.method == method and req.url == url, req.method .. " " .. req.url)
      			assert(req.headers.Authorization == nil and req.headers["X-GitHub-Api-Version"][1] == "2026-03-10")
      			if body == nil then
      				assert(req.body == nil and req.headers["Content-Type"] == nil, "unexpected body " .. tostring(req.body))
      			else
      				assert(req.headers["Content-Type"][1] == "application/json")
      				assert(same(json.decode(req.body), json.decode(body)), req.body)
      				if body == "{}" then assert(req.body == "{}", "an empty body must be an object: " .. req.body) end
      			end
      		end
      		local function rejected(fn, expected)
      			local before = #requests
      			local ok, err = pcall(fn)
      			assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err))
      			assert(#requests == before, "invalid input reached GitHub")
      		end
      
      		local names = {}
      		for name in github do if name ~= "help" then table.insert(names, name) end end
      		assert(#names == 157, "wrong full-access surface: " .. #names)
      
      		payload = '{"number":12,"title":"Crash","labels":[{"name":"bug"}]}'
      		local issue = github.createIssue({owner = "o", repo = "r", title = "Crash", body = "Steps", labels = {"bug"}})
      		sent("POST", API .. "/repos/o/r/issues", '{"title":"Crash","body":"Steps","labels":["bug"]}')
      		assert(issue.number == 12 and issue.labels[1].name == "bug")
      
      		github.updateIssue({owner = "o", repo = "r", issue_number = 12, state = "closed", milestone = NULL})
      		sent("PATCH", API .. "/repos/o/r/issues/12", '{"state":"closed","milestone":null}')
      		assert(string.find(last().body, '"milestone":null', 1, true))
      
      		payload = "[]"
      		github.setLabels({owner = "o", repo = "r", issue_number = 12, labels = json.decode("[]")})
      		sent("PUT", API .. "/repos/o/r/issues/12/labels", '{"labels":[]}')
      		assert(string.find(last().body, '"labels":[]', 1, true))
      		github.removeLabel({owner = "o", repo = "r", issue_number = 12, name = "good first issue"})
      		sent("DELETE", API .. "/repos/o/r/issues/12/labels/good%20first%20issue")
      		github.updateLabel({owner = "o", repo = "r", name = "area/ui", color = "ff0000"})
      		sent("PATCH", API .. "/repos/o/r/labels/area%2Fui", '{"color":"ff0000"}')
      		github.removeLabel({owner = "o", repo = "r", issue_number = 12, name = "50% done"})
      		sent("DELETE", API .. "/repos/o/r/issues/12/labels/50%25%20done")
      		github.deleteLabel({owner = "o", repo = "r", name = "100%"})
      		sent("DELETE", API .. "/repos/o/r/labels/100%25")
      
      		payload = '{"number":12,"assignees":[]}'
      		github.removeAssignees({owner = "o", repo = "r", issue_number = 12, assignees = {"hubot"}})
      		sent("DELETE", API .. "/repos/o/r/issues/12/assignees", '{"assignees":["hubot"]}')
      
      		payload = '{"content":{"path":"docs/a.md","sha":"new"},"commit":{"sha":"c1"}}'
      		local commit = github.putFile({owner = "o", repo = "r", path = "docs/a.md", message = "Update", content = "aGk=", sha = "old", branch = "feature/x"})
      		sent("PUT", API .. "/repos/o/r/contents/docs%2Fa.md", '{"message":"Update","content":"aGk=","sha":"old","branch":"feature/x"}')
      		assert(commit.commit.sha == "c1")
      		-- A session file streams as the base64 content, past the 8 MiB limit on strings.
      		local chunk = string.rep("binary\0", 429999) -- 3 MB, a multiple of 3 bytes
      		local function streamed() last().body = await(last().body:readAll(16 * 1024 * 1024)); return json.decode(last().body) end
      		local file = fs.open("large.bin", "w")
      		for _ = 1, 3 do await(file:write(chunk)) end
      		await(file:close())
      		github.putFile({owner = "o", repo = "r", path = "docs/large.bin", message = "Add \"large\"", content_path = "large.bin", branch = "main"})
      		local body = streamed()
      		assert(body.message == "Add \"large\"" and body.branch == "main" and body.content_path == nil, string.sub(last().body, 1, 200))
      		assert(body.content == string.rep(base64.encode(chunk), 3) and #body.content > 8 * 1024 * 1024)
      		github.createBlob({owner = "o", repo = "r", content_path = "large.bin"})
      		body = streamed()
      		assert(last().url == API .. "/repos/o/r/git/blobs" and body.encoding == "base64" and #body.content == 4 * #chunk)
      		rejected(function() github.putFile({owner = "o", repo = "r", path = "a.md", message = "m", content = "aGk=", content_path = "large.bin"}) end, "pass content or content_path, not both")
      		rejected(function() github.createBlob({owner = "o", repo = "r", content_path = "large.bin", encoding = "utf-8"}) end, "content_path sends base64")
      		rejected(function() github.createBlob({owner = "o", repo = "r", content_path = "missing.bin"}) end, "not_found")
      		github.deleteFile({owner = "o", repo = "r", path = "docs/a.md", message = "Remove", sha = "new"})
      		sent("DELETE", API .. "/repos/o/r/contents/docs%2Fa.md", '{"message":"Remove","sha":"new"}')
      
      		payload = '{"ref":"refs/heads/feature/x","object":{"sha":"c2"}}'
      		github.createRef({owner = "o", repo = "r", ref = "refs/heads/feature/x", sha = "c2"})
      		sent("POST", API .. "/repos/o/r/git/refs", '{"ref":"refs/heads/feature/x","sha":"c2"}')
      		github.updateRef({owner = "o", repo = "r", ref = "heads/feature/x", sha = "c3", force = false})
      		sent("PATCH", API .. "/repos/o/r/git/refs/heads%2Ffeature%2Fx", '{"sha":"c3","force":false}')
      		github.renameBranch({owner = "o", repo = "r", branch = "old/name", new_name = "new/name"})
      		sent("POST", API .. "/repos/o/r/branches/old%2Fname/rename", '{"new_name":"new/name"}')
      
      		payload = '{"merged":true,"sha":"m1"}'
      		assert(github.mergePull({owner = "o", repo = "r", pull_number = 5, merge_method = "squash", sha = "h1"}).merged == true)
      		sent("PUT", API .. "/repos/o/r/pulls/5/merge", '{"merge_method":"squash","sha":"h1"}')
      		payload = '{"id":9,"state":"APPROVED"}'
      		github.createPullReview({owner = "o", repo = "r", pull_number = 5, event = "APPROVE", comments = {{path = "a.go", line = 3, body = "Nice"}}})
      		sent("POST", API .. "/repos/o/r/pulls/5/reviews", '{"event":"APPROVE","comments":[{"path":"a.go","line":3,"body":"Nice"}]}')
      
      		status, payload = 202, "{}"
      		github.cancelWorkflowRun({owner = "o", repo = "r", run_id = 30433642})
      		sent("POST", API .. "/repos/o/r/actions/runs/30433642/cancel", "{}")
      		status, payload = 200, '{"workflow_run_id":1,"run_url":"https://api.github.com/repos/o/r/actions/runs/1"}'
      		local run = github.dispatchWorkflow({owner = "o", repo = "r", workflow_id = "deploy.yml", ref = "main", inputs = {env = "staging"}})
      		sent("POST", API .. "/repos/o/r/actions/workflows/deploy.yml/dispatches", '{"ref":"main","inputs":{"env":"staging"}}')
      		assert(run.workflow_run_id == 1)
      		status, payload = 204, ""
      		assert(github.deleteIssueComment({owner = "o", repo = "r", comment_id = 77}).success == true)
      		sent("DELETE", API .. "/repos/o/r/issues/comments/77")
      
      		payload = '{"id":3,"files":{"a.md":{"content":"x"}}}'
      		github.updateGist({gist_id = "aa5a315d61ae9438b18d", files = {["old.md"] = NULL, ["a.md"] = {content = "x"}}})
      		sent("PATCH", API .. "/gists/aa5a315d61ae9438b18d", '{"files":{"old.md":null,"a.md":{"content":"x"}}}')
      
      		-- GitHub requires Content-Length zero when starring, so starRepo sends no body.
      		status, payload = 204, ""
      		assert(github.starRepo({owner = "octo-org", repo = "app.js"}).success == true)
      		sent("PUT", API .. "/user/starred/octo-org/app.js")
      		assert(github.unstarRepo({owner = "octo-org", repo = "app.js"}).success == true)
      		sent("DELETE", API .. "/user/starred/octo-org/app.js")
      		assert(github.deletePullReviewComment({owner = "o", repo = "r", comment_id = 78}).success == true)
      		sent("DELETE", API .. "/repos/o/r/pulls/comments/78")
      		status, payload = 201, '{"id":3,"body":"Nice"}'
      		assert(github.createCommitComment({owner = "o", repo = "r", commit_sha = "c1", body = "Nice", path = "a.go", line = 3}).id == 3)
      		sent("POST", API .. "/repos/o/r/commits/c1/comments", '{"body":"Nice","path":"a.go","line":3}')
      		github.createIssueCommentReaction({owner = "o", repo = "r", comment_id = 77, content = "+1"})
      		sent("POST", API .. "/repos/o/r/issues/comments/77/reactions", '{"content":"+1"}')
      		github.createPullReviewCommentReaction({owner = "o", repo = "r", comment_id = 78, content = "heart"})
      		sent("POST", API .. "/repos/o/r/pulls/comments/78/reactions", '{"content":"heart"}')
      		status = 200
      		github.updatePullReviewComment({owner = "o", repo = "r", comment_id = 78, body = "Fixed"})
      		sent("PATCH", API .. "/repos/o/r/pulls/comments/78", '{"body":"Fixed"}')
      		rejected(function() github.starRepo({owner = "o", repo = "r", body = "x"}) end, "starRepo has no option body")
      		rejected(function() github.createCommitComment({owner = "o", repo = "r", commit_sha = "c1", path = "a.go"}) end, "body is required")
      		rejected(function() github.createIssueCommentReaction({owner = "o", repo = "r", comment_id = 77}) end, "content is required")
      
      		rejected(function() github.createIssue({owner = "o", repo = "r", body = "no title"}) end, "title is required")
      		rejected(function() github.putFile({owner = "o", repo = "r", path = "a.md", message = "m"}) end, "content is required")
      		rejected(function() github.deleteFile({owner = "o", repo = "r", path = "a.md", message = "m"}) end, "sha is required")
      		rejected(function() github.updateRef({owner = "o", repo = "r", ref = "heads/../main", sha = "c"}) end, "ref must be slash-separated names")
      		rejected(function() github.createRelease({owner = "o", repo = "r", name = "v1"}) end, "tag_name is required")
      		rejected(function() github.mergeBranch({owner = "o", repo = "r", base = "main"}) end, "head is required")
      		rejected(function() github.createPullReviewComment({owner = "o", repo = "r", pull_number = 5, body = "x", path = "a.go"}) end, "commit_id is required")
      		payload = '{"number":5}'
      		github.removeRequestedReviewers({owner = "o", repo = "r", pull_number = 5, reviewers = {"hubot"}})
      		sent("DELETE", API .. "/repos/o/r/pulls/5/requested_reviewers", '{"reviewers":["hubot"]}')
      		rejected(function() github.deleteIssueComment({owner = "o", repo = "r", comment_id = 1, body = "x"}) end, "deleteIssueComment has no option body")
      	end,
      }