Skip to main content

alert_autofixes

Creates, updates, deletes, gets or lists an alert_autofixes resource.

Overview

Namealert_autofixes
TypeResource
Idgithub.code_scanning.alert_autofixes

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
descriptionstringThe description of an autofix.
started_atstring (date-time)The start time of an autofix in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
statusstringThe status of an autofix. (pending, error, success, outdated)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_autofixselectowner, repo, alert_numberGets the status and description of an autofix for a code scanning alert.

OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.
create_autofixinsertowner, repo, alert_numberCreates an autofix for a code scanning alert.

If a new autofix is to be created as a result of this request or is currently being generated, then this endpoint will return a 202 Accepted response.

If an autofix already exists for a given alert, then this endpoint will return a 200 OK response.

OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.
commit_autofixexecowner, repo, alert_numberCommits an autofix for a code scanning alert.

If an autofix is committed as a result of this request, then this endpoint will return a 201 Created response.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
alert_numberintegerThe number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the number field in the response from the GET /repos/{owner}/{repo}/code-scanning/alerts operation.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.

SELECT examples

Gets the status and description of an autofix for a code scanning alert.

OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.

SELECT
description,
started_at,
status
FROM github.code_scanning.alert_autofixes
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND alert_number = '{{ alert_number }}' -- required
;

INSERT examples

Creates an autofix for a code scanning alert.

If a new autofix is to be created as a result of this request or is currently being generated, then this endpoint will return a 202 Accepted response.

If an autofix already exists for a given alert, then this endpoint will return a 200 OK response.

OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.

INSERT INTO github.code_scanning.alert_autofixes (
owner,
repo,
alert_number
)
SELECT
'{{ owner }}',
'{{ repo }}',
'{{ alert_number }}'
RETURNING
description,
started_at,
status
;

Lifecycle Methods

Commits an autofix for a code scanning alert.

If an autofix is committed as a result of this request, then this endpoint will return a 201 Created response.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.

EXEC github.code_scanning.alert_autofixes.commit_autofix 
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@alert_number='{{ alert_number }}' --required
@@json=
'{
"target_ref": "{{ target_ref }}",
"message": "{{ message }}"
}'
;