alert_autofixes
Creates, updates, deletes, gets or lists an alert_autofixes resource.
Overview
| Name | alert_autofixes |
| Type | Resource |
| Id | github.code_scanning.alert_autofixes |
Fields
The following fields are returned by SELECT queries:
- get_autofix
Response
| Name | Datatype | Description |
|---|---|---|
description | string | The description of an autofix. |
started_at | string (date-time) | The start time of an autofix in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
status | string | The status of an autofix. (pending, error, success, outdated) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_autofix | select | owner, repo, alert_number | 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. | |
create_autofix | insert | owner, repo, alert_number | 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. | |
commit_autofix | exec | owner, repo, alert_number | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
alert_number | integer | The 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. |
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
SELECT examples
- get_autofix
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
- create_autofix
- Manifest
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
;
# Description fields are for documentation purposes
- name: alert_autofixes
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the alert_autofixes resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the alert_autofixes resource.
- name: alert_number
value: {{ alert_number }}
description: Required parameter for the alert_autofixes resource.
Lifecycle Methods
- commit_autofix
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 }}"
}'
;