Skip to content

Commit 73e20ad

Browse files
feat: octokit.codeScanning.{getAlert,listAlertsForRepo} (#76)
Co-authored-by: Octokit Bot <33075676+octokitbot@users.noreply.github.com>
1 parent 1278411 commit 73e20ad

File tree

8 files changed

+287
-4
lines changed

8 files changed

+287
-4
lines changed

docs/codeScanning/getAlert.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Get a code scanning alert
3+
example: octokit.codeScanning.getAlert({ owner, repo, alert_id })
4+
route: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}
5+
scope: codeScanning
6+
type: API method
7+
---
8+
9+
# Get a code scanning alert
10+
11+
Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
12+
13+
The security `alert_id` is found at the end of the security alert's URL. For example, the security alert ID for `https://github.com/Octo-org/octo-repo/security/code-scanning/88` is `88`.
14+
15+
```js
16+
octokit.codeScanning.getAlert({
17+
owner,
18+
repo,
19+
alert_id,
20+
});
21+
```
22+
23+
## Parameters
24+
25+
<table>
26+
<thead>
27+
<tr>
28+
<th>name</th>
29+
<th>required</th>
30+
<th>description</th>
31+
</tr>
32+
</thead>
33+
<tbody>
34+
<tr><td>owner</td><td>yes</td><td>
35+
36+
owner parameter
37+
38+
</td></tr>
39+
<tr><td>repo</td><td>yes</td><td>
40+
41+
repo parameter
42+
43+
</td></tr>
44+
<tr><td>alert_id</td><td>yes</td><td>
45+
46+
alert_id parameter
47+
48+
</td></tr>
49+
</tbody>
50+
</table>
51+
52+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/code-scanning/#get-a-code-scanning-alert).
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: List code scanning alerts for a repository
3+
example: octokit.codeScanning.listAlertsForRepo({ owner, repo })
4+
route: GET /repos/{owner}/{repo}/code-scanning/alerts
5+
scope: codeScanning
6+
type: API method
7+
---
8+
9+
# List code scanning alerts for a repository
10+
11+
Lists all open code scanning alerts for a repository. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
12+
13+
```js
14+
octokit.codeScanning.listAlertsForRepo({
15+
owner,
16+
repo,
17+
});
18+
```
19+
20+
## Parameters
21+
22+
<table>
23+
<thead>
24+
<tr>
25+
<th>name</th>
26+
<th>required</th>
27+
<th>description</th>
28+
</tr>
29+
</thead>
30+
<tbody>
31+
<tr><td>owner</td><td>yes</td><td>
32+
33+
owner parameter
34+
35+
</td></tr>
36+
<tr><td>repo</td><td>yes</td><td>
37+
38+
repo parameter
39+
40+
</td></tr>
41+
<tr><td>state</td><td>no</td><td>
42+
43+
Set to `closed` to list only closed code scanning alerts.
44+
45+
</td></tr>
46+
</tbody>
47+
</table>
48+
49+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/code-scanning/#list-code-scanning-alerts-for-a-repository).

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"author": "Gregor Martynus (https://twitter.com/gr2m)",
2525
"license": "MIT",
2626
"dependencies": {
27-
"@octokit/types": "^2.13.0",
27+
"@octokit/types": "^2.14.0",
2828
"deprecation": "^2.3.1"
2929
},
3030
"devDependencies": {

scripts/update-endpoints/generated/endpoints.json

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20024,6 +20024,138 @@
2002420024
"responses": [],
2002520025
"renamed": null
2002620026
},
20027+
{
20028+
"name": "List code scanning alerts for a repository",
20029+
"scope": "codeScanning",
20030+
"id": "listAlertsForRepo",
20031+
"method": "GET",
20032+
"url": "/repos/{owner}/{repo}/code-scanning/alerts",
20033+
"isDeprecated": false,
20034+
"isLegacy": false,
20035+
"description": "Lists all open code scanning alerts for a repository. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.",
20036+
"documentationUrl": "https://developer.github.com/v3/code-scanning/#list-code-scanning-alerts-for-a-repository",
20037+
"previews": [],
20038+
"headers": [],
20039+
"parameters": [
20040+
{
20041+
"name": "owner",
20042+
"description": "owner parameter",
20043+
"in": "PATH",
20044+
"type": "string",
20045+
"required": true,
20046+
"enum": null,
20047+
"allowNull": false,
20048+
"mapToData": null,
20049+
"validation": null,
20050+
"alias": null,
20051+
"deprecated": null
20052+
},
20053+
{
20054+
"name": "repo",
20055+
"description": "repo parameter",
20056+
"in": "PATH",
20057+
"type": "string",
20058+
"required": true,
20059+
"enum": null,
20060+
"allowNull": false,
20061+
"mapToData": null,
20062+
"validation": null,
20063+
"alias": null,
20064+
"deprecated": null
20065+
},
20066+
{
20067+
"name": "state",
20068+
"description": "Set to `closed` to list only closed code scanning alerts.",
20069+
"in": "QUERY",
20070+
"type": "string",
20071+
"required": false,
20072+
"enum": null,
20073+
"allowNull": false,
20074+
"mapToData": null,
20075+
"validation": null,
20076+
"alias": null,
20077+
"deprecated": null
20078+
}
20079+
],
20080+
"responses": [
20081+
{
20082+
"code": 200,
20083+
"description": "response",
20084+
"examples": [
20085+
{
20086+
"data": "[{\"rule_id\":\"js/trivial-conditional\",\"rule_severity\":\"warning\",\"rule_description\":\"Useless conditional\",\"tool\":\"CodeQL\",\"created_at\":\"2020-05-06T12:00:00Z\",\"open\":true,\"closed_by\":null,\"closed_at\":null,\"url\":\"https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/25\",\"html_url\":\"https://github.com/Octo-org/octo-repo/security/code-scanning/25\"},{\"rule_id\":\"js/useless-expression\",\"rule_severity\":\"warning\",\"rule_description\":\"Expression has no effect\",\"tool\":\"CodeQL\",\"created_at\":\"2020-05-06T12:00:00Z\",\"open\":true,\"closed_by\":null,\"closed_at\":null,\"url\":\"https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/88\",\"html_url\":\"https://github.com/Octo-org/octo-repo/security/code-scanning/88\"}]"
20087+
}
20088+
]
20089+
}
20090+
],
20091+
"renamed": null
20092+
},
20093+
{
20094+
"name": "Get a code scanning alert",
20095+
"scope": "codeScanning",
20096+
"id": "getAlert",
20097+
"method": "GET",
20098+
"url": "/repos/{owner}/{repo}/code-scanning/alerts/{alert_id}",
20099+
"isDeprecated": false,
20100+
"isLegacy": false,
20101+
"description": "Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.\n\nThe security `alert_id` is found at the end of the security alert's URL. For example, the security alert ID for `https://github.com/Octo-org/octo-repo/security/code-scanning/88` is `88`.",
20102+
"documentationUrl": "https://developer.github.com/v3/code-scanning/#get-a-code-scanning-alert",
20103+
"previews": [],
20104+
"headers": [],
20105+
"parameters": [
20106+
{
20107+
"name": "owner",
20108+
"description": "owner parameter",
20109+
"in": "PATH",
20110+
"type": "string",
20111+
"required": true,
20112+
"enum": null,
20113+
"allowNull": false,
20114+
"mapToData": null,
20115+
"validation": null,
20116+
"alias": null,
20117+
"deprecated": null
20118+
},
20119+
{
20120+
"name": "repo",
20121+
"description": "repo parameter",
20122+
"in": "PATH",
20123+
"type": "string",
20124+
"required": true,
20125+
"enum": null,
20126+
"allowNull": false,
20127+
"mapToData": null,
20128+
"validation": null,
20129+
"alias": null,
20130+
"deprecated": null
20131+
},
20132+
{
20133+
"name": "alert_id",
20134+
"description": "alert_id parameter",
20135+
"in": "PATH",
20136+
"type": "integer",
20137+
"required": true,
20138+
"enum": null,
20139+
"allowNull": false,
20140+
"mapToData": null,
20141+
"validation": null,
20142+
"alias": null,
20143+
"deprecated": null
20144+
}
20145+
],
20146+
"responses": [
20147+
{
20148+
"code": 200,
20149+
"description": "response",
20150+
"examples": [
20151+
{
20152+
"data": "{\"rule_id\":\"js/useless-expression\",\"rule_severity\":\"warning\",\"rule_description\":\"Expression has no effect\",\"tool\":\"CodeQL\",\"created_at\":\"2020-05-06T12:00:00Z\",\"open\":true,\"closed_by\":null,\"closed_at\":null,\"url\":\"https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/88\",\"html_url\":\"https://github.com/Octo-org/octo-repo/security/code-scanning/88\"}"
20153+
}
20154+
]
20155+
}
20156+
],
20157+
"renamed": null
20158+
},
2002720159
{
2002820160
"name": "List collaborators",
2002920161
"scope": "repos",

src/generated/endpoints.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ const Endpoints: EndpointsDefaultsAndDecorations = {
372372
{ mediaType: { previews: ["antiope"] } },
373373
],
374374
},
375+
codeScanning: {
376+
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}"],
377+
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
378+
},
375379
codesOfConduct: {
376380
getAllCodesOfConduct: [
377381
"GET /codes_of_conduct",

src/generated/method-types.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,34 @@ export type RestEndpointMethods = {
17371737
endpoint: EndpointInterface<{ url: string }>;
17381738
};
17391739
};
1740+
codeScanning: {
1741+
/**
1742+
* Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
1743+
*
1744+
* The security `alert_id` is found at the end of the security alert's URL. For example, the security alert ID for `https://github.com/Octo-org/octo-repo/security/code-scanning/88` is `88`.
1745+
*/
1746+
getAlert: {
1747+
(
1748+
params?: RestEndpointMethodTypes["codeScanning"]["getAlert"]["parameters"]
1749+
): Promise<
1750+
RestEndpointMethodTypes["codeScanning"]["getAlert"]["response"]
1751+
>;
1752+
defaults: RequestInterface["defaults"];
1753+
endpoint: EndpointInterface<{ url: string }>;
1754+
};
1755+
/**
1756+
* Lists all open code scanning alerts for a repository. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
1757+
*/
1758+
listAlertsForRepo: {
1759+
(
1760+
params?: RestEndpointMethodTypes["codeScanning"]["listAlertsForRepo"]["parameters"]
1761+
): Promise<
1762+
RestEndpointMethodTypes["codeScanning"]["listAlertsForRepo"]["response"]
1763+
>;
1764+
defaults: RequestInterface["defaults"];
1765+
endpoint: EndpointInterface<{ url: string }>;
1766+
};
1767+
};
17401768
codesOfConduct: {
17411769
getAllCodesOfConduct: {
17421770
(

src/generated/parameters-and-response-types.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,24 @@ export type RestEndpointMethodTypes = {
10651065
response: Endpoints["PATCH /repos/:owner/:repo/check-runs/:check_run_id"]["response"];
10661066
};
10671067
};
1068+
codeScanning: {
1069+
getAlert: {
1070+
parameters: RequestParameters &
1071+
Omit<
1072+
Endpoints["GET /repos/:owner/:repo/code-scanning/alerts/:alert_id"]["parameters"],
1073+
"baseUrl" | "headers" | "mediaType"
1074+
>;
1075+
response: Endpoints["GET /repos/:owner/:repo/code-scanning/alerts/:alert_id"]["response"];
1076+
};
1077+
listAlertsForRepo: {
1078+
parameters: RequestParameters &
1079+
Omit<
1080+
Endpoints["GET /repos/:owner/:repo/code-scanning/alerts"]["parameters"],
1081+
"baseUrl" | "headers" | "mediaType"
1082+
>;
1083+
response: Endpoints["GET /repos/:owner/:repo/code-scanning/alerts"]["response"];
1084+
};
1085+
};
10681086
codesOfConduct: {
10691087
getAllCodesOfConduct: {
10701088
parameters: RequestParameters &

0 commit comments

Comments
 (0)