Skip to content

Commit ce99936

Browse files
authored
feat: add support for GET /enterprises/{enterprise}/code-scanning/alerts endpoint via octokit.rest.codeScanning.listAlertsForEnterprise() function (and description updates for other endpoints) (#523)
1 parent 2ad9302 commit ce99936

File tree

11 files changed

+307
-26
lines changed

11 files changed

+307
-26
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
name: List code scanning alerts for an enterprise
3+
example: octokit.rest.codeScanning.listAlertsForEnterprise({ enterprise })
4+
route: GET /enterprises/{enterprise}/code-scanning/alerts
5+
scope: codeScanning
6+
type: API method
7+
---
8+
9+
# List code scanning alerts for an enterprise
10+
11+
Lists code scanning alerts for the default branch for all eligible repositories in an enterprise. Eligible repositories are repositories that are owned by organizations that you own or for which you are a security manager. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)."
12+
13+
To use this endpoint, you must be a member of the enterprise,
14+
and you must use an access token with the `repo` scope or `security_events` scope.
15+
16+
```js
17+
octokit.rest.codeScanning.listAlertsForEnterprise({
18+
enterprise,
19+
});
20+
```
21+
22+
## Parameters
23+
24+
<table>
25+
<thead>
26+
<tr>
27+
<th>name</th>
28+
<th>required</th>
29+
<th>description</th>
30+
</tr>
31+
</thead>
32+
<tbody>
33+
<tr><td>enterprise</td><td>yes</td><td>
34+
35+
The slug version of the enterprise name. You can also substitute this value with the enterprise id.
36+
37+
</td></tr>
38+
<tr><td>tool_name</td><td>no</td><td>
39+
40+
The name of a code scanning tool. Only results by this tool will be listed. You can specify the tool by using either `tool_name` or `tool_guid`, but not both.
41+
42+
</td></tr>
43+
<tr><td>tool_guid</td><td>no</td><td>
44+
45+
The GUID of a code scanning tool. Only results by this tool will be listed. Note that some code scanning tools may not include a GUID in their analysis data. You can specify the tool by using either `tool_guid` or `tool_name`, but not both.
46+
47+
</td></tr>
48+
<tr><td>before</td><td>no</td><td>
49+
50+
A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor.
51+
52+
</td></tr>
53+
<tr><td>after</td><td>no</td><td>
54+
55+
A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor.
56+
57+
</td></tr>
58+
<tr><td>page</td><td>no</td><td>
59+
60+
Page number of the results to fetch.
61+
62+
</td></tr>
63+
<tr><td>per_page</td><td>no</td><td>
64+
65+
The number of results per page (max 100).
66+
67+
</td></tr>
68+
<tr><td>direction</td><td>no</td><td>
69+
70+
The direction to sort the results by.
71+
72+
</td></tr>
73+
<tr><td>state</td><td>no</td><td>
74+
75+
If specified, only code scanning alerts with this state will be returned.
76+
77+
</td></tr>
78+
<tr><td>sort</td><td>no</td><td>
79+
80+
The property by which to sort the results.
81+
82+
</td></tr>
83+
</tbody>
84+
</table>
85+
86+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/code-scanning#list-code-scanning-alerts-for-an-enterprise).

docs/projects/createForAuthenticatedUser.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ type: API method
88

99
# Create a user project
1010

11+
Creates a user project board. Returns a `410 Gone` status if the user does not have existing classic projects. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
12+
1113
```js
1214
octokit.rest.projects.createForAuthenticatedUser({
1315
name,

docs/projects/createForOrg.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type: API method
88

99
# Create an organization project
1010

11-
Creates an organization project board. Returns a `404 Not Found` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
11+
Creates an organization project board. Returns a `410 Gone` status if projects are disabled in the organization or if the organization does not have existing classic projects. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
1212

1313
```js
1414
octokit.rest.projects.createForOrg({

docs/projects/createForRepo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type: API method
88

99
# Create a repository project
1010

11-
Creates a repository project board. Returns a `404 Not Found` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
11+
Creates a repository project board. Returns a `410 Gone` status if projects are disabled in the repository or if the repository does not have existing classic projects. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
1212

1313
```js
1414
octokit.rest.projects.createForRepo({

docs/repos/createDispatchEvent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A custom webhook event name. Must be 100 characters or fewer.
5555
</td></tr>
5656
<tr><td>client_payload</td><td>no</td><td>
5757

58-
JSON payload with extra information about the webhook event that your action or worklow may use.
58+
JSON payload with extra information about the webhook event that your action or workflow may use.
5959

6060
</td></tr>
6161
<tr><td>client_payload.*</td><td>no</td><td>

package-lock.json

Lines changed: 15 additions & 15 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": "^6.40.0",
27+
"@octokit/types": "^6.41.0",
2828
"deprecation": "^2.3.1"
2929
},
3030
"devDependencies": {

scripts/update-endpoints/generated/endpoints.json

Lines changed: 169 additions & 4 deletions
Large diffs are not rendered by default.

src/generated/endpoints.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ const Endpoints: EndpointsDefaultsAndDecorations = {
432432
listAlertInstances: [
433433
"GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
434434
],
435+
listAlertsForEnterprise: [
436+
"GET /enterprises/{enterprise}/code-scanning/alerts",
437+
],
435438
listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"],
436439
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
437440
listAlertsInstances: [

src/generated/method-types.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,6 +2980,21 @@ export type RestEndpointMethods = {
29802980
defaults: RequestInterface["defaults"];
29812981
endpoint: EndpointInterface<{ url: string }>;
29822982
};
2983+
/**
2984+
* Lists code scanning alerts for the default branch for all eligible repositories in an enterprise. Eligible repositories are repositories that are owned by organizations that you own or for which you are a security manager. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)."
2985+
*
2986+
* To use this endpoint, you must be a member of the enterprise,
2987+
* and you must use an access token with the `repo` scope or `security_events` scope.
2988+
*/
2989+
listAlertsForEnterprise: {
2990+
(
2991+
params?: RestEndpointMethodTypes["codeScanning"]["listAlertsForEnterprise"]["parameters"]
2992+
): Promise<
2993+
RestEndpointMethodTypes["codeScanning"]["listAlertsForEnterprise"]["response"]
2994+
>;
2995+
defaults: RequestInterface["defaults"];
2996+
endpoint: EndpointInterface<{ url: string }>;
2997+
};
29832998
/**
29842999
* Lists code scanning alerts for the default branch for all eligible repositories in an organization. Eligible repositories are repositories that are owned by organizations that you own or for which you are a security manager. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)."
29853000
*
@@ -6788,7 +6803,9 @@ export type RestEndpointMethods = {
67886803
defaults: RequestInterface["defaults"];
67896804
endpoint: EndpointInterface<{ url: string }>;
67906805
};
6791-
6806+
/**
6807+
* Creates a user project board. Returns a `410 Gone` status if the user does not have existing classic projects. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
6808+
*/
67926809
createForAuthenticatedUser: {
67936810
(
67946811
params?: RestEndpointMethodTypes["projects"]["createForAuthenticatedUser"]["parameters"]
@@ -6799,7 +6816,7 @@ export type RestEndpointMethods = {
67996816
endpoint: EndpointInterface<{ url: string }>;
68006817
};
68016818
/**
6802-
* Creates an organization project board. Returns a `404 Not Found` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
6819+
* Creates an organization project board. Returns a `410 Gone` status if projects are disabled in the organization or if the organization does not have existing classic projects. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
68036820
*/
68046821
createForOrg: {
68056822
(
@@ -6811,7 +6828,7 @@ export type RestEndpointMethods = {
68116828
endpoint: EndpointInterface<{ url: string }>;
68126829
};
68136830
/**
6814-
* Creates a repository project board. Returns a `404 Not Found` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
6831+
* Creates a repository project board. Returns a `410 Gone` status if projects are disabled in the repository or if the repository does not have existing classic projects. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
68156832
*/
68166833
createForRepo: {
68176834
(

0 commit comments

Comments
 (0)