Create a check run

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.

Creates a new check run for a specific commit in a repository. Your GitHub App must have the checks:write permission to create check runs.

In a check suite, GitHub limits the number of check runs with the same name to 1000. Once these check runs exceed 1000, GitHub will start to automatically delete older check runs.

octokit.checks.create({
owner,
repo,
name,
head_sha,
output.title,
output.summary,
output.annotations[].path,
output.annotations[].start_line,
output.annotations[].end_line,
output.annotations[].annotation_level,
output.annotations[].message,
output.images[].alt,
output.images[].image_url,
actions[].label,
actions[].description,
actions[].identifier
})

Parameters

namerequireddescription
owneryes
repoyes
nameyes

The name of the check. For example, "code-coverage".

head_shayes

The SHA of the commit.

details_urlno

The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used.

external_idno

A reference for the run on the integrator's system.

statusno

The current status. Can be one of queued, in_progress, or completed.

started_atno

The time that the check run began. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

conclusionno

Required if you provide completed_at or a status of completed. The final conclusion of the check. Can be one of action_required, cancelled, failure, neutral, success, skipped, stale, or timed_out. When the conclusion is action_required, additional details should be provided on the site specified by details_url.Note: Providing conclusion will automatically set the status parameter to completed. You cannot change a check run conclusion to stale, only GitHub can set this.

completed_atno

The time the check completed. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

outputno

Check runs can accept a variety of data in the output object, including a title and summary and can optionally provide descriptive details about the run. See the output object description.

output.titleyes

The title of the check run.

output.summaryyes

The summary of the check run. This parameter supports Markdown.

output.textno

The details of the check run. This parameter supports Markdown.

output.annotationsno

Adds information from your analysis to specific lines of code. Annotations are visible on GitHub in the Checks and Files changed tab of the pull request. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the Update a check run endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about how you can view annotations on GitHub, see "About status checks". See the annotations object description for details about how to use this parameter.

output.annotations[].pathyes

The path of the file to add an annotation to. For example, assets/css/main.css.

output.annotations[].start_lineyes

The start line of the annotation.

output.annotations[].end_lineyes

The end line of the annotation.

output.annotations[].start_columnno

The start column of the annotation. Annotations only support start_column and end_column on the same line. Omit this parameter if start_line and end_line have different values.

output.annotations[].end_columnno

The end column of the annotation. Annotations only support start_column and end_column on the same line. Omit this parameter if start_line and end_line have different values.

output.annotations[].annotation_levelyes

The level of the annotation. Can be one of notice, warning, or failure.

output.annotations[].messageyes

A short description of the feedback for these lines of code. The maximum size is 64 KB.

output.annotations[].titleno

The title that represents the annotation. The maximum size is 255 characters.

output.annotations[].raw_detailsno

Details about this annotation. The maximum size is 64 KB.

output.imagesno

Adds images to the output displayed in the GitHub pull request UI. See the images object description for details.

output.images[].altyes

The alternative text for the image.

output.images[].image_urlyes

The full URL of the image.

output.images[].captionno

A short image description.

actionsno

Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the check_run.requested_action webhook to your app. Each action includes a label, identifier and description. A maximum of three actions are accepted. See the actions object description. To learn more about check runs and requested actions, see "Check runs and requested actions." To learn more about check runs and requested actions, see "Check runs and requested actions."

actions[].labelyes

The text to be displayed on a button in the web UI. The maximum size is 20 characters.

actions[].descriptionyes

A short explanation of what this action would do. The maximum size is 40 characters.

actions[].identifieryes

A reference for the action on the integrator's system. The maximum size is 20 characters.

See also: GitHub Developer Guide documentation.

Create a check suite

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.

By default, check suites are automatically created when you create a check run. You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using "Update repository preferences for check suites". Your GitHub App must have the checks:write permission to create check suites.

octokit.checks.createSuite({
owner,
repo,
head_sha,
});

Parameters

namerequireddescription
owneryes
repoyes
head_shayes

The sha of the head commit.

See also: GitHub Developer Guide documentation.

Get a check run

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.

Gets a single check run using its id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the repo scope to get check runs in a private repository.

octokit.checks.get({
owner,
repo,
check_run_id,
});

Parameters

namerequireddescription
owneryes
repoyes
check_run_idyes

check_run_id parameter

See also: GitHub Developer Guide documentation.

Get a check suite

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.

Gets a single check suite using its id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check suites. OAuth Apps and authenticated users must have the repo scope to get check suites in a private repository.

octokit.checks.getSuite({
owner,
repo,
check_suite_id,
});

Parameters

namerequireddescription
owneryes
repoyes
check_suite_idyes

check_suite_id parameter

See also: GitHub Developer Guide documentation.

List check run annotations

Lists annotations for a check run using the annotation id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get annotations for a check run. OAuth Apps and authenticated users must have the repo scope to get annotations for a check run in a private repository.

octokit.checks.listAnnotations({
owner,
repo,
check_run_id,
});

Parameters

namerequireddescription
owneryes
repoyes
check_run_idyes

check_run_id parameter

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List check runs for a Git reference

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.

Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the repo scope to get check runs in a private repository.

octokit.checks.listForRef({
owner,
repo,
ref,
});

Parameters

namerequireddescription
owneryes
repoyes
refyes

ref+ parameter

check_nameno

Returns check runs with the specified name.

statusno

Returns check runs with the specified status. Can be one of queued, in_progress, or completed.

filterno

Filters check runs by their completed_at timestamp. Can be one of latest (returning the most recent check runs) or all.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List check runs in a check suite

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.

Lists check runs for a check suite using its id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the repo scope to get check runs in a private repository.

octokit.checks.listForSuite({
owner,
repo,
check_suite_id,
});

Parameters

namerequireddescription
owneryes
repoyes
check_suite_idyes

check_suite_id parameter

check_nameno

Returns check runs with the specified name.

statusno

Returns check runs with the specified status. Can be one of queued, in_progress, or completed.

filterno

Filters check runs by their completed_at timestamp. Can be one of latest (returning the most recent check runs) or all.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List check suites for a Git reference

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.

Lists check suites for a commit ref. The ref can be a SHA, branch name, or a tag name. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have the repo scope to get check suites in a private repository.

octokit.checks.listSuitesForRef({
owner,
repo,
ref,
});

Parameters

namerequireddescription
owneryes
repoyes
refyes

ref+ parameter

app_idno

Filters check suites by GitHub App id.

check_nameno

Returns check runs with the specified name.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

Rerequest a check suite

Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the check_suite webhook event with the action rerequested. When a check suite is rerequested, its status is reset to queued and the conclusion is cleared.

To rerequest a check suite, your GitHub App must have the checks:read permission on a private repository or pull access to a public repository.

octokit.checks.rerequestSuite({
owner,
repo,
check_suite_id,
});

Parameters

namerequireddescription
owneryes
repoyes
check_suite_idyes

check_suite_id parameter

See also: GitHub Developer Guide documentation.

Update repository preferences for check suites

Changes the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually Create a check suite. You must have admin permissions in the repository to set preferences for check suites.

octokit.checks.setSuitesPreferences({
owner,
repo,
auto_trigger_checks[].app_id,
auto_trigger_checks[].setting
})

Parameters

namerequireddescription
owneryes
repoyes
auto_trigger_checksno

Enables or disables automatic creation of CheckSuite events upon pushes to the repository. Enabled by default. See the auto_trigger_checks object description for details.

auto_trigger_checks[].app_idyes

The id of the GitHub App.

auto_trigger_checks[].settingyes

Set to true to enable automatic creation of CheckSuite events upon pushes to the repository, or false to disable them.

See also: GitHub Developer Guide documentation.

Update a check run

Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.

Updates a check run for a specific commit in a repository. Your GitHub App must have the checks:write permission to edit check runs.

octokit.checks.update({
owner,
repo,
check_run_id,
output.summary,
output.annotations[].path,
output.annotations[].start_line,
output.annotations[].end_line,
output.annotations[].annotation_level,
output.annotations[].message,
output.images[].alt,
output.images[].image_url,
actions[].label,
actions[].description,
actions[].identifier
})

Parameters

namerequireddescription
owneryes
repoyes
check_run_idyes

check_run_id parameter

nameno

The name of the check. For example, "code-coverage".

details_urlno

The URL of the integrator's site that has the full details of the check.

external_idno

A reference for the run on the integrator's system.

started_atno

This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

statusno

The current status. Can be one of queued, in_progress, or completed.

conclusionno

Required if you provide completed_at or a status of completed. The final conclusion of the check. Can be one of action_required, cancelled, failure, neutral, success, skipped, stale, or timed_out.Note: Providing conclusion will automatically set the status parameter to completed. You cannot change a check run conclusion to stale, only GitHub can set this.

completed_atno

The time the check completed. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

outputno

Check runs can accept a variety of data in the output object, including a title and summary and can optionally provide descriptive details about the run. See the output object description.

output.titleno

Required.

output.summaryyes

Can contain Markdown.

output.textno

Can contain Markdown.

output.annotationsno

Adds information from your analysis to specific lines of code. Annotations are visible in GitHub's pull request UI. Annotations are visible in GitHub's pull request UI. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the Update a check run endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about annotations in the UI, see "About status checks". See the annotations object description for details.

output.annotations[].pathyes

The path of the file to add an annotation to. For example, assets/css/main.css.

output.annotations[].start_lineyes

The start line of the annotation.

output.annotations[].end_lineyes

The end line of the annotation.

output.annotations[].start_columnno

The start column of the annotation. Annotations only support start_column and end_column on the same line. Omit this parameter if start_line and end_line have different values.

output.annotations[].end_columnno

The end column of the annotation. Annotations only support start_column and end_column on the same line. Omit this parameter if start_line and end_line have different values.

output.annotations[].annotation_levelyes

The level of the annotation. Can be one of notice, warning, or failure.

output.annotations[].messageyes

A short description of the feedback for these lines of code. The maximum size is 64 KB.

output.annotations[].titleno

The title that represents the annotation. The maximum size is 255 characters.

output.annotations[].raw_detailsno

Details about this annotation. The maximum size is 64 KB.

output.imagesno

Adds images to the output displayed in the GitHub pull request UI. See the images object description for details.

output.images[].altyes

The alternative text for the image.

output.images[].image_urlyes

The full URL of the image.

output.images[].captionno

A short image description.

actionsno

Possible further actions the integrator can perform, which a user may trigger. Each action includes a label, identifier and description. A maximum of three actions are accepted. See the actions object description. To learn more about check runs and requested actions, see "Check runs and requested actions."

actions[].labelyes

The text to be displayed on a button in the web UI. The maximum size is 20 characters.

actions[].descriptionyes

A short explanation of what this action would do. The maximum size is 40 characters.

actions[].identifieryes

A reference for the action on the integrator's system. The maximum size is 20 characters.

See also: GitHub Developer Guide documentation.