Docs menu

Platform APIs

GitHub API

Every handle of the GitHub fake: the github fixture, the people and objects a test creates on it, and what they read and wait for. How to test a GitHub app or agent, step by step, is in the GitHub guide.

Each call is shown in every SDK's language, with its required options (the table under it lists them all). Arguments go first; options are TypeScript's trailing object, Python's keyword arguments and Rust's builder setters. The variable names are the ones the calls return elsewhere on these pages, so user is a GitHubUser handle.

Besides the errors listed with each method, most methods can fail with action_requires, cross_workspace_credential, fake_actor_in_live_world, internal, invalid_argument, live_misconfigured, live_not_allowlisted, not_found, session_not_found, unauthorized, unsupported_in_live: a bad request, a closed session, or live mode refusing or misconfigured.

GitHubFixture#

Returned by Session.github().

FieldPython / RustType
appappGitHubApp
apiUrlapi_urlstring
orgorgstring

createUser()#

Create a person in the org.

const user = await github.createUser({ login: "…" });
ParameterTypeRequired
loginstringyesoption
idnumbernooption
namestringnooption
emailstringnooption
role"member" | "admin" | "outside_collaborator"nooption
tokenstringnooption; read from CHANNELSTACK_GITHUB_USER_{login}_TOKEN when left out

Returns GitHubUser.

users()#

The people this session created.

const users = await github.users();

Returns GitHubUsers.

createRepo()#

Create a repository in the org. The App hears about it only when it is listed in apps: an App must be installed on a repository.

const repo = await github.createRepo({ name: "…" });
ParameterPython / RustTypeRequired
namenamestringnooption
privateprivatebooleannooption
defaultBranchdefault_branchstringnooption
filesfilesstring | FileInput[]nooption
collaboratorscollaboratorsArray<GitHubUser | { user: GitHubUser; permission?: "read" | "triage" | "write" | "maintain" | "admin" }>nooption
appsappsGitHubApp[]nooption
labelslabelsArray<string | { name: string; color?: string; description?: string }>nooption

Returns GitHubRepo.

repos()#

The repositories this session created.

const repos = await github.repos();

Returns GitHubRepos.

issues()#

The issues and pull requests in this session's repositories, read again from GitHub live, the most recently updated last.

const issues = await github.issues();

Returns GitHubIssues.

installationId()#

The id of the built-in App's installation, for a repository it is installed on. The same as github.app.installationId(repo).

const result = await github.installationId(repo);
ParameterTypeRequired
repoGitHubRepoyespositional

Returns number.

createApp()#

Make another GitHub App on the org, with its own App id, bot user, installation, private key and webhook secret (decision 0027), or return the one made with this name and settings. It reaches no repository until it is installed on one; its webhooks go to CHANNELSTACK_GITHUB_APP_<NAME>_WEBHOOK_URL.

const app = await github.createApp({ name: "…" });
ParameterTypeRequired
namestringyesoption
permissionsRecord<string, "read" | "write">nooption
eventsstring[]nooption

Returns GitHubApp.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

apps()#

The Apps this session used: the built-in one first, then each it got from createApp, in the order it first did. Another session's are not_found here.

const apps = await github.apps();

Returns GitHubApps.

deliveries()#

Every webhook channelstack sent the agent for this session, with every attempt.

const deliveries = await github.deliveries({ type: "…" });
ParameterPython / RustTypeRequired
typetype · r#typestringnooption
resourceresourceGitHubReponooption
appappGitHubAppnooption

Returns GitHubDeliveries.

calls()#

The REST calls the agent made about this session's repositories. Calls about no repository (GET /app) are in no session.

const apiCalls = await github.calls({ operation: "…" });
ParameterTypeRequired
operationstringnooption
errortrue | stringnooption

Returns GitHubApiCalls.

Live: needs proxy mode: GitHub doesn't report the App's calls; proxy mode sees them. Proxy mode doesn't read the app's calls back live yet (#24), so for now the call is refused with action_requires and the test is skipped.

appCalls()#

The App's REST calls that are about no repository of any session: its own endpoints and the token exchange. They belong to no session, so every session reads the same list. Only calls that authenticated as the App or its installation are on it.

const appCalls = await github.appCalls({ operation: "…" });
ParameterTypeRequired
operationstringnooption
errortrue | stringnooption

Returns GitHubAppCalls.

Live: needs proxy mode: GitHub doesn't report the App's calls; proxy mode sees them. Proxy mode doesn't read the app's calls back live yet (#24), so for now the call is refused with action_requires and the test is skipped.

waitForCall()#

Waits for the next API call from the agent after the last one this handle returned: it polls calls() and never sleeps longer than it must.

const apiCall = await github.waitForCall({ operation: "…" });
ParameterTypeRequired
operationstringnofilter
errortrue | stringnofilter
timeoutDurationnodefault 10s

Returns GitHubApiCall. When the time is up, it fails with what it was waiting for.

GitHubApp#

Returned by GitHubFixture.createApp().

FieldPython / RustType
ididstring
namenamestring
kindkind"app"
slugslugstring
botLoginbot_loginstring
botUserIdbot_user_idstring
appIdapp_idnumber
privateKeyprivate_keystring
webhookSecretwebhook_secretstring

installationId()#

The id of this App's installation, for a repository it is installed on.

const result = await app.installationId(repo);
ParameterTypeRequired
repoGitHubRepoyespositional

Returns number.

push()#

Push a commit to a branch (created from the default branch if it isn't there). Sends push, and pull_request synchronize for open pull requests from it.

const commit = await app.push(changes, { repo, branch: "…" });
ParameterTypeRequired
changesFileInput[] | Record<string, string | null>yespositional
repoGitHubRepoyesoption
branchstringyesoption
messagestringnooption

Returns GitHubCommit.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

openIssue()#

Open an issue. Sends issues (action opened).

const result = await app.openIssue(issue, { repo });
ParameterTypeRequired
issue{ title: string; body?: string; labels?: string[]; assignees?: Array<GitHubUser | GitHubApp> }yespositional
repoGitHubRepoyesoption

Returns GitHubIssue.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

openPullRequest()#

Open a pull request. With changes, they are pushed to from first; without, from is an existing branch. Sends pull_request (action opened).

const pullRequest = await app.openPullRequest(pr, { repo });
ParameterTypeRequired
pr{ from: string; to?: string; title?: string; body?: string; changes?: FileInput[] | Record<string, string | null>; draft?: boolean; reviewers?: Array<GitHubUser | GitHubApp> }yespositional
repoGitHubRepoyesoption

Returns GitHubPullRequest.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

editIssue()#

Edit the title or the body of an issue or a pull request. Sends issues or pull_request (action edited).

const delivery = await app.editIssue(changes, { issue });
ParameterTypeRequired
changes{ title?: string; body?: string }yespositional
issueGitHubIssueyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

close()#

Close an issue or a pull request. Sends issues or pull_request (action closed).

const delivery = await app.close({ issue });
ParameterTypeRequired
issueGitHubIssueyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

reopen()#

Reopen an issue or a pull request. Sends issues or pull_request (action reopened).

const delivery = await app.reopen({ issue });
ParameterTypeRequired
issueGitHubIssueyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

label()#

Put labels on an issue or a pull request. Sends one labeled event per label.

const labelDeliveries = await app.label(labels, { issue });
ParameterTypeRequired
labelsstring | string[]yespositional
issueGitHubIssueyesoption

Returns GitHubLabelDeliveries.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

unlabel()#

Take labels off an issue or a pull request. Sends one unlabeled event per label.

const unlabelDeliveries = await app.unlabel(labels, { issue });
ParameterTypeRequired
labelsstring | string[]yespositional
issueGitHubIssueyesoption

Returns GitHubUnlabelDeliveries.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

assign()#

Assign people or the App's bot. Sends one assigned event per assignee.

const assignDeliveries = await app.assign(assignees, { issue });
ParameterTypeRequired
assigneesGitHubUser | GitHubApp | Array<GitHubUser | GitHubApp>yespositional
issueGitHubIssueyesoption

Returns GitHubAssignDeliveries.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

comment()#

Comment on an issue or a pull request's conversation. Sends issue_comment (action created).

const comment = await app.comment("…", { issue });
ParameterTypeRequired
bodystringyespositional
issueGitHubIssueyesoption

Returns GitHubComment.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

edit()#

Edit a conversation comment or a comment on the diff. Sends the comment's event with action edited.

const delivery = await app.edit("…", { comment });
ParameterTypeRequired
bodystringyespositional
commentGitHubComment | GitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

delete()#

Delete a conversation comment or a comment on the diff. Sends the comment's event with action deleted.

const delivery = await app.delete({ comment });
ParameterTypeRequired
commentGitHubComment | GitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

react()#

React to an issue, a pull request or a comment. GitHub sends no webhook for a reaction.

await app.react(content, { issue });
ParameterTypeRequired
content"+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"yespositional
issueGitHubIssuenooption
commentGitHubComment | GitHubReviewCommentnooption

Returns nothing.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

minimize()#

Hide a comment as outdated, spam, off-topic or resolved. GitHub sends no webhook for it.

await app.minimize({ comment });
ParameterTypeRequired
commentGitHubCommentyesoption
reason"OUTDATED" | "SPAM" | "OFF_TOPIC" | "RESOLVED"nooption

Returns nothing.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

review()#

Submit a review, with comments on the diff if any. Sends pull_request_review, and one pull_request_review_comment per comment.

const result = await app.review(review);
ParameterTypeRequired
review{ pr: GitHubPullRequest; event: "COMMENT" | "APPROVE" | "REQUEST_CHANGES"; body?: string; comments?: Array<{ path: string; line: number; side?: "LEFT" | "RIGHT"; startLine?: number; body: string }> }yespositional

Returns GitHubReview.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

reviewComment()#

One comment on the diff, outside a review. Sends pull_request_review_comment.

const reviewComment = await app.reviewComment("…", { pr, path: "…", line });
ParameterTypeRequired
bodystringyespositional
prGitHubPullRequestyesoption
pathstringyesoption
linenumberyesoption
side"LEFT" | "RIGHT"nooption

Returns GitHubReviewComment.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

reply()#

Reply in a thread on the diff. Sends pull_request_review_comment.

const reviewComment = await app.reply("…", { comment });
ParameterTypeRequired
bodystringyespositional
commentGitHubReviewCommentyesoption

Returns GitHubReviewComment.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

resolve()#

Resolve a thread on the diff. Sends pull_request_review_thread.

const delivery = await app.resolve({ comment });
ParameterTypeRequired
commentGitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

unresolve()#

Reopen a thread on the diff. Sends pull_request_review_thread.

const delivery = await app.unresolve({ comment });
ParameterTypeRequired
commentGitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

requestReview()#

Request a review from people or the App's bot. Sends pull_request (action review_requested) per reviewer.

const delivery = await app.requestReview(reviewers, { pr });
ParameterTypeRequired
reviewersGitHubUser | GitHubApp | Array<GitHubUser | GitHubApp>yespositional
prGitHubPullRequestyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

markReady()#

Mark a draft pull request as ready for review. Sends pull_request (action ready_for_review).

const delivery = await app.markReady({ pr });
ParameterTypeRequired
prGitHubPullRequestyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

merge()#

Merge a pull request. Sends push for the base branch, then pull_request (action closed, merged).

const delivery = await app.merge({ pr });
ParameterTypeRequired
prGitHubPullRequestyesoption
method"merge" | "squash" | "rebase"nooption

Returns GitHubDelivery | undefined.

Errors forbidden, not_allowed.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

GitHubUser#

Returned by GitHubFixture.createUser().

FieldPython / RustType
ididstring
namenamestring
kindkind"user"
loginloginstring
numericIdnumeric_idnumber
displayNamedisplay_namestring | undefined
emailemailstring | undefined
rolerole"member" | "admin" | "outside_collaborator"

push()#

Push a commit to a branch (created from the default branch if it isn't there). Sends push, and pull_request synchronize for open pull requests from it.

const commit = await user.push(changes, { repo, branch: "…" });
ParameterTypeRequired
changesFileInput[] | Record<string, string | null>yespositional
repoGitHubRepoyesoption
branchstringyesoption
messagestringnooption

Returns GitHubCommit.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

openIssue()#

Open an issue. Sends issues (action opened).

const result = await user.openIssue(issue, { repo });
ParameterTypeRequired
issue{ title: string; body?: string; labels?: string[]; assignees?: Array<GitHubUser | GitHubApp> }yespositional
repoGitHubRepoyesoption

Returns GitHubIssue.

Errors forbidden, validation_failed.

openPullRequest()#

Open a pull request. With changes, they are pushed to from first; without, from is an existing branch. Sends pull_request (action opened).

const pullRequest = await user.openPullRequest(pr, { repo });
ParameterTypeRequired
pr{ from: string; to?: string; title?: string; body?: string; changes?: FileInput[] | Record<string, string | null>; draft?: boolean; reviewers?: Array<GitHubUser | GitHubApp> }yespositional
repoGitHubRepoyesoption

Returns GitHubPullRequest.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

editIssue()#

Edit the title or the body of an issue or a pull request. Sends issues or pull_request (action edited).

const delivery = await user.editIssue(changes, { issue });
ParameterTypeRequired
changes{ title?: string; body?: string }yespositional
issueGitHubIssueyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

close()#

Close an issue or a pull request. Sends issues or pull_request (action closed).

const delivery = await user.close({ issue });
ParameterTypeRequired
issueGitHubIssueyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

reopen()#

Reopen an issue or a pull request. Sends issues or pull_request (action reopened).

const delivery = await user.reopen({ issue });
ParameterTypeRequired
issueGitHubIssueyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

label()#

Put labels on an issue or a pull request. Sends one labeled event per label.

const labelDeliveries = await user.label(labels, { issue });
ParameterTypeRequired
labelsstring | string[]yespositional
issueGitHubIssueyesoption

Returns GitHubLabelDeliveries.

Errors forbidden.

unlabel()#

Take labels off an issue or a pull request. Sends one unlabeled event per label.

const unlabelDeliveries = await user.unlabel(labels, { issue });
ParameterTypeRequired
labelsstring | string[]yespositional
issueGitHubIssueyesoption

Returns GitHubUnlabelDeliveries.

Errors forbidden.

assign()#

Assign people or the App's bot. Sends one assigned event per assignee.

const assignDeliveries = await user.assign(assignees, { issue });
ParameterTypeRequired
assigneesGitHubUser | GitHubApp | Array<GitHubUser | GitHubApp>yespositional
issueGitHubIssueyesoption

Returns GitHubAssignDeliveries.

Errors forbidden, validation_failed.

comment()#

Comment on an issue or a pull request's conversation. Sends issue_comment (action created).

const comment = await user.comment("…", { issue });
ParameterTypeRequired
bodystringyespositional
issueGitHubIssueyesoption

Returns GitHubComment.

Errors forbidden.

edit()#

Edit a conversation comment or a comment on the diff. Sends the comment's event with action edited.

const delivery = await user.edit("…", { comment });
ParameterTypeRequired
bodystringyespositional
commentGitHubComment | GitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

delete()#

Delete a conversation comment or a comment on the diff. Sends the comment's event with action deleted.

const delivery = await user.delete({ comment });
ParameterTypeRequired
commentGitHubComment | GitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

react()#

React to an issue, a pull request or a comment. GitHub sends no webhook for a reaction.

await user.react(content, { issue });
ParameterTypeRequired
content"+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"yespositional
issueGitHubIssuenooption
commentGitHubComment | GitHubReviewCommentnooption

Returns nothing.

Errors forbidden.

minimize()#

Hide a comment as outdated, spam, off-topic or resolved. GitHub sends no webhook for it.

await user.minimize({ comment });
ParameterTypeRequired
commentGitHubCommentyesoption
reason"OUTDATED" | "SPAM" | "OFF_TOPIC" | "RESOLVED"nooption

Returns nothing.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

review()#

Submit a review, with comments on the diff if any. Sends pull_request_review, and one pull_request_review_comment per comment.

const result = await user.review(review);
ParameterTypeRequired
review{ pr: GitHubPullRequest; event: "COMMENT" | "APPROVE" | "REQUEST_CHANGES"; body?: string; comments?: Array<{ path: string; line: number; side?: "LEFT" | "RIGHT"; startLine?: number; body: string }> }yespositional

Returns GitHubReview.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

reviewComment()#

One comment on the diff, outside a review. Sends pull_request_review_comment.

const reviewComment = await user.reviewComment("…", { pr, path: "…", line });
ParameterTypeRequired
bodystringyespositional
prGitHubPullRequestyesoption
pathstringyesoption
linenumberyesoption
side"LEFT" | "RIGHT"nooption

Returns GitHubReviewComment.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

reply()#

Reply in a thread on the diff. Sends pull_request_review_comment.

const reviewComment = await user.reply("…", { comment });
ParameterTypeRequired
bodystringyespositional
commentGitHubReviewCommentyesoption

Returns GitHubReviewComment.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

resolve()#

Resolve a thread on the diff. Sends pull_request_review_thread.

const delivery = await user.resolve({ comment });
ParameterTypeRequired
commentGitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

unresolve()#

Reopen a thread on the diff. Sends pull_request_review_thread.

const delivery = await user.unresolve({ comment });
ParameterTypeRequired
commentGitHubReviewCommentyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

requestReview()#

Request a review from people or the App's bot. Sends pull_request (action review_requested) per reviewer.

const delivery = await user.requestReview(reviewers, { pr });
ParameterTypeRequired
reviewersGitHubUser | GitHubApp | Array<GitHubUser | GitHubApp>yespositional
prGitHubPullRequestyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

markReady()#

Mark a draft pull request as ready for review. Sends pull_request (action ready_for_review).

const delivery = await user.markReady({ pr });
ParameterTypeRequired
prGitHubPullRequestyesoption

Returns GitHubDelivery | undefined.

Errors forbidden, validation_failed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

merge()#

Merge a pull request. Sends push for the base branch, then pull_request (action closed, merged).

const delivery = await user.merge({ pr });
ParameterTypeRequired
prGitHubPullRequestyesoption
method"merge" | "squash" | "rebase"nooption

Returns GitHubDelivery | undefined.

Errors forbidden, not_allowed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

rerun()#

Click "Re-run" on a check run. Sends check_run (action rerequested).

const delivery = await user.rerun({ checkRun });
ParameterPython / RustTypeRequired
checkRuncheck_runGitHubCheckRunyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: refused with unsupported_in_live: not yet: a person's Re-run is a click in GitHub's UI, and the API lets only the owning App rerequest.

requestAction()#

Click one of the buttons the App put on a check run. Sends check_run (action requested_action).

const delivery = await user.requestAction("…", { checkRun });
ParameterPython / RustTypeRequired
identifieridentifierstringyespositional
checkRuncheck_runGitHubCheckRunyesoption

Returns GitHubDelivery | undefined.

Errors forbidden.

Live: needs the browser actor: GitHub sends this only when a person clicks in the UI. The browser actor doesn't do this yet (#47), so for now the call is refused with action_requires and the test is skipped.

GitHubRepo#

Returned by GitHubFixture.createRepo().

FieldPython / RustType
ididstring
ownerownerstring
namenamestring
fullNamefull_namestring
defaultBranchdefault_branchstring
privateprivateboolean

installApp()#

Install an App on this repository. Sends that App installation_repositories.

const delivery = await repo.installApp(app);
ParameterTypeRequired
appGitHubAppyespositional

Returns GitHubDelivery | undefined.

Errors validation_failed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

uninstallApp()#

Take an App off this repository. Sends that App installation_repositories.

const delivery = await repo.uninstallApp(app);
ParameterTypeRequired
appGitHubAppyespositional

Returns GitHubDelivery | undefined.

Errors validation_failed.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

issue()#

An issue of this repository by its number.

const issue = await repo.issue(number);
ParameterTypeRequired
numbernumberyespositional

Returns GitHubIssue.

pullRequest()#

A pull request of this repository by its number.

const pullRequest = await repo.pullRequest(number);
ParameterTypeRequired
numbernumberyespositional

Returns GitHubPullRequest.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

readFile()#

A file's text as it is on a branch (the default branch without ref), or nothing when it isn't there.

const result = await repo.readFile("…", { ref: "…" });
ParameterPython / RustTypeRequired
pathpathstringyespositional
refref · r#refstringnooption

Returns string | undefined. It reads once the app is quiet.

commits()#

The commits of a branch (the default branch without branch), newest first.

const commits = await repo.commits({ branch: "…" });
ParameterTypeRequired
branchstringnooption

Returns GitHubCommits.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

GitHubIssue#

Returned by GitHubApp.openIssue(), GitHubUser.openIssue(), GitHubRepo.issue(), GitHubIssue.refresh().

FieldPython / RustType
repoIdrepo_idstring
numbernumbernumber
reporepoGitHubRepo
urlurlstring
authorauthorGitHubUser | GitHubApp

refresh()#

Read the issue again.

const updated = await issue.refresh();

Returns GitHubIssue.

title()#

The issue's title as it is now.

const result = await issue.title();

Returns string.

state()#

Open or closed, once the agent is quiet.

const result = await issue.state();

Returns "open" | "closed". It reads once the app is quiet.

labels()#

The names of the labels on it.

const items = await issue.labels();

Returns string[].

assignees()#

Who it is assigned to.

const items = await issue.assignees();

Returns Array<GitHubUser | GitHubApp>.

comments()#

The comments of the conversation, oldest first.

const comments = await issue.comments();

Returns GitHubComments.

transcript()#

The issue or pull request as a person reads it: description, comments, reviews and threads.

const transcript = await issue.transcript();

Returns GitHubTranscript.

waitForComment()#

Waits for the next comment after the last one this handle returned: it polls comments() and never sleeps longer than it must.

const comment = await issue.waitForComment({ from: "my-agent" });
ParameterPython / RustTypeRequired
fromfrom_ · fromGitHubUser | GitHubApp | stringnoa handle, or a name
bodybodystring | RegExpnocontains, or matches
timeouttimeoutDurationnodefault 10s

Returns GitHubComment. When the time is up, it fails with what it was waiting for.

latestComment()#

The latest comment, once the app is quiet. Waits for at least one: it polls comments() and never sleeps longer than it must.

const comment = await issue.latestComment({ from: "my-agent" });
ParameterPython / RustTypeRequired
fromfrom_ · fromGitHubUser | GitHubApp | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s
quietForquiet_forDurationnodefault 750ms

Returns GitHubComment. When the time is up, it fails with what it was waiting for.

GitHubDelivery#

Returned by GitHubApp.editIssue(), GitHubApp.close(), GitHubApp.reopen(), GitHubApp.edit().

FieldPython / RustType
ididstring
channelchannel"github"
appappstring
typetype · r#typestring
actionactionstring | undefined
guidguidstring
payloadpayloadunknown | undefined
attemptsattemptsDeliveryAttempt[]
statusstatus"pending" | "acknowledged" | "failed" | "timed_out" | "unreachable"

refresh()#

Re-read a delivery: its attempts and status.

const updated = await delivery.refresh();

Returns GitHubDelivery.

redeliver()#

Redeliver from the App's delivery log, as GitHub's UI and API do: the same GUID, a new attempt.

const deliveryAttempt = await delivery.redeliver();

Returns DeliveryAttempt.

resend()#

Send the delivery again, unchanged or signed with a secret that isn't the App's.

const deliveryAttempt = await delivery.resend({ badSignature });
ParameterPython / RustTypeRequired
badSignaturebad_signaturebooleannooption

Returns DeliveryAttempt.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

settled()#

Waits for the delivery to settle: it polls refresh() and never sleeps longer than it must.

const updated = await delivery.settled();
ParameterTypeRequired
timeoutDurationnodefault 10s

Returns GitHubDelivery. When the time is up, it fails with what it was waiting for.

GitHubCommit#

Returned by GitHubApp.push(), GitHubUser.push(), GitHubPullRequest.headCommit().

FieldPython / RustType
repoIdrepo_idstring
shashastring
messagemessagestring
authorauthorGitHubUser | GitHubApp | undefined
branchbranchstring
committedAtcommitted_atstring

checkRuns()#

The check runs on this commit: the newest of each name.

const checkRuns = await commit.checkRuns();

Returns GitHubCheckRuns.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

statuses()#

The commit statuses on this commit: the newest of each context.

const statuses = await commit.statuses();

Returns GitHubStatuses.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

GitHubCheckRun#

FieldPython / RustType
ididnumber
namenamestring
appapp{ slug: string }
headShahead_shastring
statusstatus"queued" | "in_progress" | "completed"
conclusionconclusion"success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | undefined
titletitlestring | undefined
summarysummarystring | undefined
annotationsannotationsArray<{ path: string; startLine: number; endLine: number; level: "notice" | "warning" | "failure"; message: string }>
actionsactionsstring[]

GitHubComment#

Returned by GitHubApp.comment(), GitHubUser.comment(), GitHubComment.refresh().

FieldPython / RustType
ididnumber
urlurlstring
issueissueGitHubIssue
authorauthorGitHubUser | GitHubApp
bodybodystring
createdAtcreated_atstring
deliverydeliveryGitHubDelivery | undefined

refresh()#

Read a conversation comment again.

const updated = await comment.refresh();

Returns GitHubComment.

reactions()#

The reactions on a conversation comment, by content.

const reactions = await comment.reactions();

Returns GitHubReactions.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

deliveryFor()#

The issue_comment (created) delivery this comment caused to this App (decision 0027), or nothing when it wasn't told. The comment's delivery is the built-in App's.

const delivery = await comment.deliveryFor(app);
ParameterTypeRequired
appGitHubAppyespositional

Returns GitHubDelivery | undefined.

Live: refused with unsupported_in_live: not yet: live, the org holds only the App channelstack has credentials for.

GitHubReviewComment#

Returned by GitHubApp.reviewComment(), GitHubApp.reply(), GitHubUser.reviewComment(), GitHubUser.reply().

FieldType
idnumber
prGitHubPullRequest
authorGitHubUser | GitHubApp
pathstring
linenumber
side"LEFT" | "RIGHT"
bodystring
deliveryGitHubDelivery | undefined

replies()#

The replies in this comment's thread, once the agent is quiet.

const reviewCommentReplies = await reviewComment.replies();

Returns GitHubReviewCommentReplies. It reads once the app is quiet.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

resolved()#

Is this comment's thread resolved?.

const result = await reviewComment.resolved();

Returns boolean.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

transcript()#

This comment's thread as a person reads it.

const transcript = await reviewComment.transcript();

Returns GitHubTranscript.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

GitHubPullRequest#

A kind of GitHubIssue: it has all its fields and methods.

Returned by GitHubApp.openPullRequest(), GitHubUser.openPullRequest(), GitHubRepo.pullRequest(), GitHubPullRequest.refresh().

FieldPython / RustType
repoIdrepo_idstring
numbernumbernumber
reporepoGitHubRepo
urlurlstring
authorauthorGitHubUser | GitHubApp
headheadstring
basebasestring

refresh()#

Read the pull request again.

const updated = await pullRequest.refresh();

Returns GitHubPullRequest.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

headCommit()#

The newest commit of the pull request's branch, once the agent is quiet.

const commit = await pullRequest.headCommit();

Returns GitHubCommit. It reads once the app is quiet.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

reviews()#

The submitted reviews, oldest first.

const reviews = await pullRequest.reviews();

Returns GitHubReviews.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

reviewComments()#

The comments on the diff, oldest first.

const reviewComments = await pullRequest.reviewComments();

Returns GitHubReviewComments.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

checkRuns()#

The check runs on the pull request's newest commit: the newest of each name.

const pullCheckRuns = await pullRequest.checkRuns();

Returns GitHubPullCheckRuns.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

merged()#

Has the pull request been merged?.

const result = await pullRequest.merged();

Returns boolean.

Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.

Types#

Plain values the handles return and take.

GitHubUsers#

type GitHubUsers = GitHubUser[];

GitHubRepos#

type GitHubRepos = GitHubRepo[];

GitHubIssues#

type GitHubIssues = GitHubIssueListing[];

GitHubIssueListing#

FieldPython / RustType
issueissueGitHubIssue
titletitlestring
pullRequestpull_requestboolean

GitHubApps#

type GitHubApps = GitHubApp[];

GitHubCommits#

type GitHubCommits = GitHubCommit[];

GitHubCheckRuns#

type GitHubCheckRuns = GitHubCheckRun[];

GitHubStatuses#

type GitHubStatuses = Array<{ context: string; state: "pending" | "success" | "failure" | "error"; author: GitHubUser | GitHubApp }>;

GitHubLabelDeliveries#

type GitHubLabelDeliveries = GitHubDelivery[];

GitHubUnlabelDeliveries#

type GitHubUnlabelDeliveries = GitHubDelivery[];

GitHubAssignDeliveries#

type GitHubAssignDeliveries = GitHubDelivery[];

GitHubReview#

FieldType
idnumber
authorGitHubUser | GitHubApp
state"COMMENTED" | "APPROVED" | "CHANGES_REQUESTED" | "DISMISSED" | "PENDING"
bodystring
commentsGitHubReviewComment[]
deliveryGitHubDelivery | undefined

GitHubComments#

type GitHubComments = GitHubComment[];

GitHubTranscript#

FieldType
entriesGitHubTranscriptEntry[]
textstring

GitHubTranscriptEntry#

FieldType
idstring
authorGitHubPrincipal
atstring
textstring
controlsstring[]
editedboolean
depthnumber

GitHubPrincipal#

FieldType
idstring
namestring
kind"user" | "app"

GitHubReviews#

type GitHubReviews = GitHubReview[];

GitHubReviewComments#

type GitHubReviewComments = GitHubReviewComment[];

GitHubPullCheckRuns#

type GitHubPullCheckRuns = GitHubCheckRun[];

GitHubReactions#

type GitHubReactions = GitHubReaction[];

GitHubReaction#

FieldType
content"+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"
byArray<GitHubUser | GitHubApp>

GitHubReviewCommentReplies#

type GitHubReviewCommentReplies = GitHubReviewComment[];

GitHubDeliveries#

type GitHubDeliveries = GitHubDelivery[];

GitHubApiCalls#

type GitHubApiCalls = GitHubApiCall[];

GitHubApiCall#

FieldPython / RustType
ididstring
channelchannel"github"
operationoperationstring
methodmethodstring
pathpathstring
atatstring
durationMsduration_msnumber
requestrequestunknown | undefined
responseStatusresponse_statusnumber
responseresponseunknown | undefined
errorerrorstring | undefined

GitHubAppCalls#

type GitHubAppCalls = GitHubApiCall[];

This page is generated from the control API's routes by codegen/src/emit/docs.ts: suggest changes there.