POST
/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix/commitsCommit an autofix for a code scanning alert
Commits an autofix for a code scanning alert from the repository's default branch.
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.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
alert_numberintegerrequired
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.
target_refstringoptional
The Git reference of target branch for the commit. Branch needs to already exist. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation.
messagestringoptional
Commit message to be used.
201Created
target_refstringoptional
The Git reference of target branch for the commit. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation.
shastringoptional
SHA of commit with autofix.
400Bad Request
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Response if the repository is archived or if GitHub Advanced Security is not enabled for this repository
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Unprocessable Entity
503Service unavailable
codestringoptional
messagestringoptional
documentation_urlstringoptional
Error handling
A 400 is returned: Bad Request. A 403 is returned: Response if the repository is archived or if GitHub Advanced Security is not enabled for this repository. A 404 is returned: Resource not found. A 422 is returned: Unprocessable Entity. A 503 is returned: Service unavailable.