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().
| Field | Python / Rust | Type |
|---|---|---|
app | app | GitHubApp |
apiUrl | api_url | string |
org | org | string |
createUser()#
Create a person in the org.
const user = await github.createUser({ login: "…" });user = await github.create_user(login="…")let user = github.create_user().login("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
login | string | yes | option |
id | number | no | option |
name | string | no | option |
email | string | no | option |
role | "member" | "admin" | "outside_collaborator" | no | option |
token | string | no | option; read from CHANNELSTACK_GITHUB_USER_{login}_TOKEN when left out |
Returns GitHubUser.
users()#
The people this session created.
const users = await github.users();users = await github.users()let users = github.users().await?;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: "…" });repo = await github.create_repo(name="…")let repo = github.create_repo().name("…").await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
name | name | string | no | option |
private | private | boolean | no | option |
defaultBranch | default_branch | string | no | option |
files | files | string | FileInput[] | no | option |
collaborators | collaborators | Array<GitHubUser | { user: GitHubUser; permission?: "read" | "triage" | "write" | "maintain" | "admin" }> | no | option |
apps | apps | GitHubApp[] | no | option |
labels | labels | Array<string | { name: string; color?: string; description?: string }> | no | option |
Returns GitHubRepo.
repos()#
The repositories this session created.
const repos = await github.repos();repos = await github.repos()let repos = github.repos().await?;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();issues = await github.issues()let issues = github.issues().await?;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);result = await github.installation_id(repo)let result = github.installation_id(&repo).await?;| Parameter | Type | Required | |
|---|---|---|---|
repo | GitHubRepo | yes | positional |
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: "…" });app = await github.create_app(name="…")let app = github.create_app().name("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
name | string | yes | option |
permissions | Record<string, "read" | "write"> | no | option |
events | string[] | no | option |
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();apps = await github.apps()let apps = github.apps().await?;Returns GitHubApps.
deliveries()#
Every webhook channelstack sent the agent for this session, with every attempt.
const deliveries = await github.deliveries({ type: "…" });deliveries = await github.deliveries(type="…")let deliveries = github.deliveries().r#type("…").await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
type | type · r#type | string | no | option |
resource | resource | GitHubRepo | no | option |
app | app | GitHubApp | no | option |
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: "…" });api_calls = await github.calls(operation="…")let api_calls = github.calls().operation("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
operation | string | no | option |
error | true | string | no | option |
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: "…" });app_calls = await github.app_calls(operation="…")let app_calls = github.app_calls().operation("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
operation | string | no | option |
error | true | string | no | option |
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: "…" });api_call = await github.wait_for_call(operation="…")let api_call = github.wait_for_call().operation("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
operation | string | no | filter |
error | true | string | no | filter |
timeout | Duration | no | default 10s |
Returns GitHubApiCall. When the time is up, it fails with what it was waiting for.
GitHubApp#
Returned by GitHubFixture.createApp().
| Field | Python / Rust | Type |
|---|---|---|
id | id | string |
name | name | string |
kind | kind | "app" |
slug | slug | string |
botLogin | bot_login | string |
botUserId | bot_user_id | string |
appId | app_id | number |
privateKey | private_key | string |
webhookSecret | webhook_secret | string |
installationId()#
The id of this App's installation, for a repository it is installed on.
const result = await app.installationId(repo);result = await app.installation_id(repo)let result = app.installation_id(&repo).await?;| Parameter | Type | Required | |
|---|---|---|---|
repo | GitHubRepo | yes | positional |
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: "…" });commit = await app.push(changes, repo=repo, branch="…")let commit = app.push(changes).repo(&repo).branch("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
changes | FileInput[] | Record<string, string | null> | yes | positional |
repo | GitHubRepo | yes | option |
branch | string | yes | option |
message | string | no | option |
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 });result = await app.open_issue(issue, repo=repo)let result = app.open_issue(issue).repo(&repo).await?;| Parameter | Type | Required | |
|---|---|---|---|
issue | { title: string; body?: string; labels?: string[]; assignees?: Array<GitHubUser | GitHubApp> } | yes | positional |
repo | GitHubRepo | yes | option |
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 });pull_request = await app.open_pull_request(pr, repo=repo)let pull_request = app.open_pull_request(pr).repo(&repo).await?;| Parameter | Type | Required | |
|---|---|---|---|
pr | { from: string; to?: string; title?: string; body?: string; changes?: FileInput[] | Record<string, string | null>; draft?: boolean; reviewers?: Array<GitHubUser | GitHubApp> } | yes | positional |
repo | GitHubRepo | yes | option |
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 });delivery = await app.edit_issue(changes, issue=issue)let delivery = app.edit_issue(changes).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
changes | { title?: string; body?: string } | yes | positional |
issue | GitHubIssue | yes | option |
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 });delivery = await app.close(issue=issue)let delivery = app.close().issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
issue | GitHubIssue | yes | option |
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 });delivery = await app.reopen(issue=issue)let delivery = app.reopen().issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
issue | GitHubIssue | yes | option |
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 });label_deliveries = await app.label(labels, issue=issue)let label_deliveries = app.label(labels).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
labels | string | string[] | yes | positional |
issue | GitHubIssue | yes | option |
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 });unlabel_deliveries = await app.unlabel(labels, issue=issue)let unlabel_deliveries = app.unlabel(labels).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
labels | string | string[] | yes | positional |
issue | GitHubIssue | yes | option |
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 });assign_deliveries = await app.assign(assignees, issue=issue)let assign_deliveries = app.assign(assignees).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
assignees | GitHubUser | GitHubApp | Array<GitHubUser | GitHubApp> | yes | positional |
issue | GitHubIssue | yes | option |
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 });comment = await app.comment("…", issue=issue)let comment = app.comment("…").issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
issue | GitHubIssue | yes | option |
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 });delivery = await app.edit("…", comment=comment)let delivery = app.edit("…").comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
comment | GitHubComment | GitHubReviewComment | yes | option |
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 });delivery = await app.delete(comment=comment)let delivery = app.delete().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubComment | GitHubReviewComment | yes | option |
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 });await app.react(content, issue=issue)app.react(content).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
content | "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes" | yes | positional |
issue | GitHubIssue | no | option |
comment | GitHubComment | GitHubReviewComment | no | option |
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 });await app.minimize(comment=comment)app.minimize().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubComment | yes | option |
reason | "OUTDATED" | "SPAM" | "OFF_TOPIC" | "RESOLVED" | no | option |
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);result = await app.review(review)let result = app.review(review).await?;| Parameter | Type | Required | |
|---|---|---|---|
review | { pr: GitHubPullRequest; event: "COMMENT" | "APPROVE" | "REQUEST_CHANGES"; body?: string; comments?: Array<{ path: string; line: number; side?: "LEFT" | "RIGHT"; startLine?: number; body: string }> } | yes | positional |
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 });review_comment = await app.review_comment("…", pr=pr, path="…", line=line)let review_comment = app.review_comment("…").pr(&pr).path("…").line(line).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
pr | GitHubPullRequest | yes | option |
path | string | yes | option |
line | number | yes | option |
side | "LEFT" | "RIGHT" | no | option |
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 });review_comment = await app.reply("…", comment=comment)let review_comment = app.reply("…").comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
comment | GitHubReviewComment | yes | option |
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 });delivery = await app.resolve(comment=comment)let delivery = app.resolve().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubReviewComment | yes | option |
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 });delivery = await app.unresolve(comment=comment)let delivery = app.unresolve().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubReviewComment | yes | option |
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 });delivery = await app.request_review(reviewers, pr=pr)let delivery = app.request_review(reviewers).pr(&pr).await?;| Parameter | Type | Required | |
|---|---|---|---|
reviewers | GitHubUser | GitHubApp | Array<GitHubUser | GitHubApp> | yes | positional |
pr | GitHubPullRequest | yes | option |
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 });delivery = await app.mark_ready(pr=pr)let delivery = app.mark_ready().pr(&pr).await?;| Parameter | Type | Required | |
|---|---|---|---|
pr | GitHubPullRequest | yes | option |
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 });delivery = await app.merge(pr=pr)let delivery = app.merge().pr(&pr).await?;| Parameter | Type | Required | |
|---|---|---|---|
pr | GitHubPullRequest | yes | option |
method | "merge" | "squash" | "rebase" | no | option |
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().
| Field | Python / Rust | Type |
|---|---|---|
id | id | string |
name | name | string |
kind | kind | "user" |
login | login | string |
numericId | numeric_id | number |
displayName | display_name | string | undefined |
email | email | string | undefined |
role | role | "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: "…" });commit = await user.push(changes, repo=repo, branch="…")let commit = user.push(changes).repo(&repo).branch("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
changes | FileInput[] | Record<string, string | null> | yes | positional |
repo | GitHubRepo | yes | option |
branch | string | yes | option |
message | string | no | option |
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 });result = await user.open_issue(issue, repo=repo)let result = user.open_issue(issue).repo(&repo).await?;| Parameter | Type | Required | |
|---|---|---|---|
issue | { title: string; body?: string; labels?: string[]; assignees?: Array<GitHubUser | GitHubApp> } | yes | positional |
repo | GitHubRepo | yes | option |
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 });pull_request = await user.open_pull_request(pr, repo=repo)let pull_request = user.open_pull_request(pr).repo(&repo).await?;| Parameter | Type | Required | |
|---|---|---|---|
pr | { from: string; to?: string; title?: string; body?: string; changes?: FileInput[] | Record<string, string | null>; draft?: boolean; reviewers?: Array<GitHubUser | GitHubApp> } | yes | positional |
repo | GitHubRepo | yes | option |
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 });delivery = await user.edit_issue(changes, issue=issue)let delivery = user.edit_issue(changes).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
changes | { title?: string; body?: string } | yes | positional |
issue | GitHubIssue | yes | option |
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 });delivery = await user.close(issue=issue)let delivery = user.close().issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
issue | GitHubIssue | yes | option |
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 });delivery = await user.reopen(issue=issue)let delivery = user.reopen().issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
issue | GitHubIssue | yes | option |
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 });label_deliveries = await user.label(labels, issue=issue)let label_deliveries = user.label(labels).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
labels | string | string[] | yes | positional |
issue | GitHubIssue | yes | option |
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 });unlabel_deliveries = await user.unlabel(labels, issue=issue)let unlabel_deliveries = user.unlabel(labels).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
labels | string | string[] | yes | positional |
issue | GitHubIssue | yes | option |
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 });assign_deliveries = await user.assign(assignees, issue=issue)let assign_deliveries = user.assign(assignees).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
assignees | GitHubUser | GitHubApp | Array<GitHubUser | GitHubApp> | yes | positional |
issue | GitHubIssue | yes | option |
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 });comment = await user.comment("…", issue=issue)let comment = user.comment("…").issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
issue | GitHubIssue | yes | option |
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 });delivery = await user.edit("…", comment=comment)let delivery = user.edit("…").comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
comment | GitHubComment | GitHubReviewComment | yes | option |
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 });delivery = await user.delete(comment=comment)let delivery = user.delete().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubComment | GitHubReviewComment | yes | option |
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 });await user.react(content, issue=issue)user.react(content).issue(&issue).await?;| Parameter | Type | Required | |
|---|---|---|---|
content | "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes" | yes | positional |
issue | GitHubIssue | no | option |
comment | GitHubComment | GitHubReviewComment | no | option |
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 });await user.minimize(comment=comment)user.minimize().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubComment | yes | option |
reason | "OUTDATED" | "SPAM" | "OFF_TOPIC" | "RESOLVED" | no | option |
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);result = await user.review(review)let result = user.review(review).await?;| Parameter | Type | Required | |
|---|---|---|---|
review | { pr: GitHubPullRequest; event: "COMMENT" | "APPROVE" | "REQUEST_CHANGES"; body?: string; comments?: Array<{ path: string; line: number; side?: "LEFT" | "RIGHT"; startLine?: number; body: string }> } | yes | positional |
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 });review_comment = await user.review_comment("…", pr=pr, path="…", line=line)let review_comment = user.review_comment("…").pr(&pr).path("…").line(line).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
pr | GitHubPullRequest | yes | option |
path | string | yes | option |
line | number | yes | option |
side | "LEFT" | "RIGHT" | no | option |
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 });review_comment = await user.reply("…", comment=comment)let review_comment = user.reply("…").comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
body | string | yes | positional |
comment | GitHubReviewComment | yes | option |
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 });delivery = await user.resolve(comment=comment)let delivery = user.resolve().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubReviewComment | yes | option |
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 });delivery = await user.unresolve(comment=comment)let delivery = user.unresolve().comment(&comment).await?;| Parameter | Type | Required | |
|---|---|---|---|
comment | GitHubReviewComment | yes | option |
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 });delivery = await user.request_review(reviewers, pr=pr)let delivery = user.request_review(reviewers).pr(&pr).await?;| Parameter | Type | Required | |
|---|---|---|---|
reviewers | GitHubUser | GitHubApp | Array<GitHubUser | GitHubApp> | yes | positional |
pr | GitHubPullRequest | yes | option |
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 });delivery = await user.mark_ready(pr=pr)let delivery = user.mark_ready().pr(&pr).await?;| Parameter | Type | Required | |
|---|---|---|---|
pr | GitHubPullRequest | yes | option |
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 });delivery = await user.merge(pr=pr)let delivery = user.merge().pr(&pr).await?;| Parameter | Type | Required | |
|---|---|---|---|
pr | GitHubPullRequest | yes | option |
method | "merge" | "squash" | "rebase" | no | option |
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 });delivery = await user.rerun(check_run=check_run)let delivery = user.rerun().check_run(&check_run).await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
checkRun | check_run | GitHubCheckRun | yes | option |
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 });delivery = await user.request_action("…", check_run=check_run)let delivery = user.request_action("…").check_run(&check_run).await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
identifier | identifier | string | yes | positional |
checkRun | check_run | GitHubCheckRun | yes | option |
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().
| Field | Python / Rust | Type |
|---|---|---|
id | id | string |
owner | owner | string |
name | name | string |
fullName | full_name | string |
defaultBranch | default_branch | string |
private | private | boolean |
installApp()#
Install an App on this repository. Sends that App installation_repositories.
const delivery = await repo.installApp(app);delivery = await repo.install_app(app)let delivery = repo.install_app(&app).await?;| Parameter | Type | Required | |
|---|---|---|---|
app | GitHubApp | yes | positional |
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);delivery = await repo.uninstall_app(app)let delivery = repo.uninstall_app(&app).await?;| Parameter | Type | Required | |
|---|---|---|---|
app | GitHubApp | yes | positional |
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);issue = await repo.issue(number)let issue = repo.issue(number).await?;| Parameter | Type | Required | |
|---|---|---|---|
number | number | yes | positional |
Returns GitHubIssue.
pullRequest()#
A pull request of this repository by its number.
const pullRequest = await repo.pullRequest(number);pull_request = await repo.pull_request(number)let pull_request = repo.pull_request(number).await?;| Parameter | Type | Required | |
|---|---|---|---|
number | number | yes | positional |
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: "…" });result = await repo.read_file("…", ref="…")let result = repo.read_file("…").r#ref("…").await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
path | path | string | yes | positional |
ref | ref · r#ref | string | no | option |
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: "…" });commits = await repo.commits(branch="…")let commits = repo.commits().branch("…").await?;| Parameter | Type | Required | |
|---|---|---|---|
branch | string | no | option |
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().
| Field | Python / Rust | Type |
|---|---|---|
repoId | repo_id | string |
number | number | number |
repo | repo | GitHubRepo |
url | url | string |
author | author | GitHubUser | GitHubApp |
refresh()#
Read the issue again.
const updated = await issue.refresh();updated = await issue.refresh()let updated = issue.refresh().await?;Returns GitHubIssue.
title()#
The issue's title as it is now.
const result = await issue.title();result = await issue.title()let result = issue.title().await?;Returns string.
state()#
Open or closed, once the agent is quiet.
const result = await issue.state();result = await issue.state()let result = issue.state().await?;Returns "open" | "closed". It reads once the app is quiet.
labels()#
The names of the labels on it.
const items = await issue.labels();items = await issue.labels()let items = issue.labels().await?;Returns string[].
assignees()#
Who it is assigned to.
const items = await issue.assignees();items = await issue.assignees()let items = issue.assignees().await?;Returns Array<GitHubUser | GitHubApp>.
comments()#
The comments of the conversation, oldest first.
const comments = await issue.comments();comments = await issue.comments()let comments = issue.comments().await?;Returns GitHubComments.
transcript()#
The issue or pull request as a person reads it: description, comments, reviews and threads.
const transcript = await issue.transcript();transcript = await issue.transcript()let transcript = issue.transcript().await?;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" });comment = await issue.wait_for_comment(from_="my-agent")let comment = issue.wait_for_comment().from("my-agent").await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
from | from_ · from | GitHubUser | GitHubApp | string | no | a handle, or a name |
body | body | string | RegExp | no | contains, or matches |
timeout | timeout | Duration | no | default 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" });comment = await issue.latest_comment(from_="my-agent")let comment = issue.latest_comment().from("my-agent").await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
from | from_ · from | GitHubUser | GitHubApp | string | no | a handle, or a name |
timeout | timeout | Duration | no | default 10s |
quietFor | quiet_for | Duration | no | default 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().
| Field | Python / Rust | Type |
|---|---|---|
id | id | string |
channel | channel | "github" |
app | app | string |
type | type · r#type | string |
action | action | string | undefined |
guid | guid | string |
payload | payload | unknown | undefined |
attempts | attempts | DeliveryAttempt[] |
status | status | "pending" | "acknowledged" | "failed" | "timed_out" | "unreachable" |
refresh()#
Re-read a delivery: its attempts and status.
const updated = await delivery.refresh();updated = await delivery.refresh()let updated = delivery.refresh().await?;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();delivery_attempt = await delivery.redeliver()let delivery_attempt = delivery.redeliver().await?;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 });delivery_attempt = await delivery.resend(bad_signature=bad_signature)let delivery_attempt = delivery.resend().bad_signature(bad_signature).await?;| Parameter | Python / Rust | Type | Required | |
|---|---|---|---|---|
badSignature | bad_signature | boolean | no | option |
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();updated = await delivery.settled()let updated = delivery.settled().await?;| Parameter | Type | Required | |
|---|---|---|---|
timeout | Duration | no | default 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().
| Field | Python / Rust | Type |
|---|---|---|
repoId | repo_id | string |
sha | sha | string |
message | message | string |
author | author | GitHubUser | GitHubApp | undefined |
branch | branch | string |
committedAt | committed_at | string |
checkRuns()#
The check runs on this commit: the newest of each name.
const checkRuns = await commit.checkRuns();check_runs = await commit.check_runs()let check_runs = commit.check_runs().await?;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();statuses = await commit.statuses()let statuses = commit.statuses().await?;Returns GitHubStatuses.
Live: refused with unsupported_in_live: not yet: pull requests, reviews, pushes, checks and installs aren't built live.
GitHubCheckRun#
| Field | Python / Rust | Type |
|---|---|---|
id | id | number |
name | name | string |
app | app | { slug: string } |
headSha | head_sha | string |
status | status | "queued" | "in_progress" | "completed" |
conclusion | conclusion | "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | undefined |
title | title | string | undefined |
summary | summary | string | undefined |
annotations | annotations | Array<{ path: string; startLine: number; endLine: number; level: "notice" | "warning" | "failure"; message: string }> |
actions | actions | string[] |
GitHubComment#
Returned by GitHubApp.comment(), GitHubUser.comment(), GitHubComment.refresh().
| Field | Python / Rust | Type |
|---|---|---|
id | id | number |
url | url | string |
issue | issue | GitHubIssue |
author | author | GitHubUser | GitHubApp |
body | body | string |
createdAt | created_at | string |
delivery | delivery | GitHubDelivery | undefined |
refresh()#
Read a conversation comment again.
const updated = await comment.refresh();updated = await comment.refresh()let updated = comment.refresh().await?;Returns GitHubComment.
reactions()#
The reactions on a conversation comment, by content.
const reactions = await comment.reactions();reactions = await comment.reactions()let reactions = comment.reactions().await?;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);delivery = await comment.delivery_for(app)let delivery = comment.delivery_for(&app).await?;| Parameter | Type | Required | |
|---|---|---|---|
app | GitHubApp | yes | positional |
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().
| Field | Type |
|---|---|
id | number |
pr | GitHubPullRequest |
author | GitHubUser | GitHubApp |
path | string |
line | number |
side | "LEFT" | "RIGHT" |
body | string |
delivery | GitHubDelivery | undefined |
replies()#
The replies in this comment's thread, once the agent is quiet.
const reviewCommentReplies = await reviewComment.replies();review_comment_replies = await review_comment.replies()let review_comment_replies = review_comment.replies().await?;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();result = await review_comment.resolved()let result = review_comment.resolved().await?;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();transcript = await review_comment.transcript()let transcript = review_comment.transcript().await?;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().
| Field | Python / Rust | Type |
|---|---|---|
repoId | repo_id | string |
number | number | number |
repo | repo | GitHubRepo |
url | url | string |
author | author | GitHubUser | GitHubApp |
head | head | string |
base | base | string |
refresh()#
Read the pull request again.
const updated = await pullRequest.refresh();updated = await pull_request.refresh()let updated = pull_request.refresh().await?;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();commit = await pull_request.head_commit()let commit = pull_request.head_commit().await?;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();reviews = await pull_request.reviews()let reviews = pull_request.reviews().await?;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();review_comments = await pull_request.review_comments()let review_comments = pull_request.review_comments().await?;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();pull_check_runs = await pull_request.check_runs()let pull_check_runs = pull_request.check_runs().await?;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();result = await pull_request.merged()let result = pull_request.merged().await?;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#
| Field | Python / Rust | Type |
|---|---|---|
issue | issue | GitHubIssue |
title | title | string |
pullRequest | pull_request | boolean |
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#
| Field | Type |
|---|---|
id | number |
author | GitHubUser | GitHubApp |
state | "COMMENTED" | "APPROVED" | "CHANGES_REQUESTED" | "DISMISSED" | "PENDING" |
body | string |
comments | GitHubReviewComment[] |
delivery | GitHubDelivery | undefined |
GitHubComments#
type GitHubComments = GitHubComment[];
GitHubTranscript#
| Field | Type |
|---|---|
entries | GitHubTranscriptEntry[] |
text | string |
GitHubTranscriptEntry#
| Field | Type |
|---|---|
id | string |
author | GitHubPrincipal |
at | string |
text | string |
controls | string[] |
edited | boolean |
depth | number |
GitHubPrincipal#
| Field | Type |
|---|---|
id | string |
name | string |
kind | "user" | "app" |
GitHubReviews#
type GitHubReviews = GitHubReview[];
GitHubReviewComments#
type GitHubReviewComments = GitHubReviewComment[];
GitHubPullCheckRuns#
type GitHubPullCheckRuns = GitHubCheckRun[];
GitHubReactions#
type GitHubReactions = GitHubReaction[];
GitHubReaction#
| Field | Type |
|---|---|
content | "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes" |
by | Array<GitHubUser | GitHubApp> |
GitHubReviewCommentReplies#
type GitHubReviewCommentReplies = GitHubReviewComment[];
GitHubDeliveries#
type GitHubDeliveries = GitHubDelivery[];
GitHubApiCalls#
type GitHubApiCalls = GitHubApiCall[];
GitHubApiCall#
| Field | Python / Rust | Type |
|---|---|---|
id | id | string |
channel | channel | "github" |
operation | operation | string |
method | method | string |
path | path | string |
at | at | string |
durationMs | duration_ms | number |
request | request | unknown | undefined |
responseStatus | response_status | number |
response | response | unknown | undefined |
error | error | string | undefined |
GitHubAppCalls#
type GitHubAppCalls = GitHubApiCall[];