Skip to content

Commit e01de33

Browse files
octokitbotgr2m
andauthored
feat: octokit.secretScanning.{getAlert,listAlertsForRepo,updateAlert} (#298)
Co-authored-by: Gregor Martynus <[email protected]>
1 parent 788c8a8 commit e01de33

File tree

13 files changed

+539
-66
lines changed

13 files changed

+539
-66
lines changed

docs/actions/getWorkflowRunUsage.md

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

99
# Get workflow run usage
1010

11-
**Warning:** This GitHub Actions usage endpoint is currently in public beta and subject to change. For more information, see "[GitHub Actions API workflow usage](https://developer.github.com/changes/2020-05-15-actions-api-workflow-usage)."
12-
1311
Gets the number of billable minutes and total run time for a specific workflow run. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
1412

1513
Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint.

docs/actions/getWorkflowUsage.md

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

99
# Get workflow usage
1010

11-
**Warning:** This GitHub Actions usage endpoint is currently in public beta and subject to change. For more information, see "[GitHub Actions API workflow usage](https://developer.github.com/changes/2020-05-15-actions-api-workflow-usage)."
12-
1311
Gets the number of billable minutes used by a specific workflow during the current billing cycle. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
1412

1513
You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint.

docs/codeScanning/updateAlert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ octokit.codeScanning.updateAlert({
3939
</td></tr>
4040
<tr><td>alert_number</td><td>yes</td><td>
4141

42-
The code scanning alert number.
42+
The security alert number, found at the end of the security alert's URL.
4343

4444
</td></tr>
4545
<tr><td>state</td><td>yes</td><td>

docs/repos/getRepoPermissions.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

docs/secretScanning/getAlert.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Get a secret scanning alert
3+
example: octokit.secretScanning.getAlert({ owner, repo, alert_number })
4+
route: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}
5+
scope: secretScanning
6+
type: API method
7+
---
8+
9+
# Get a secret scanning alert
10+
11+
Gets a single secret scanning alert detected in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the `repo` scope or `security_events` scope.
12+
13+
GitHub Apps must have the `secret_scanning_alerts` read permission to use this endpoint.
14+
15+
```js
16+
octokit.secretScanning.getAlert({
17+
owner,
18+
repo,
19+
alert_number,
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+
</td></tr>
37+
<tr><td>repo</td><td>yes</td><td>
38+
39+
</td></tr>
40+
<tr><td>alert_number</td><td>yes</td><td>
41+
42+
The security alert number, found at the end of the security alert's URL.
43+
44+
</td></tr>
45+
</tbody>
46+
</table>
47+
48+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/secret-scanning#get-a-secret-scanning-alert).
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: List secret scanning alerts for a repository
3+
example: octokit.secretScanning.listAlertsForRepo({ owner, repo })
4+
route: GET /repos/{owner}/{repo}/secret-scanning/alerts
5+
scope: secretScanning
6+
type: API method
7+
---
8+
9+
# List secret scanning alerts for a repository
10+
11+
Lists all secret scanning alerts for a private repository, from newest to oldest. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the `repo` scope or `security_events` scope.
12+
13+
GitHub Apps must have the `secret_scanning_alerts` read permission to use this endpoint.
14+
15+
```js
16+
octokit.secretScanning.listAlertsForRepo({
17+
owner,
18+
repo,
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>owner</td><td>yes</td><td>
34+
35+
</td></tr>
36+
<tr><td>repo</td><td>yes</td><td>
37+
38+
</td></tr>
39+
<tr><td>state</td><td>no</td><td>
40+
41+
Set to `open` or `resolved` to only list secret scanning alerts in a specific state.
42+
43+
</td></tr>
44+
<tr><td>page</td><td>no</td><td>
45+
46+
Page number of the results to fetch.
47+
48+
</td></tr>
49+
<tr><td>per_page</td><td>no</td><td>
50+
51+
Results per page (max 100)
52+
53+
</td></tr>
54+
</tbody>
55+
</table>
56+
57+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/secret-scanning#list-secret-scanning-alerts-for-a-repository).

docs/secretScanning/updateAlert.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Update a secret scanning alert
3+
example: octokit.secretScanning.updateAlert({ owner, repo, alert_number, state })
4+
route: PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}
5+
scope: secretScanning
6+
type: API method
7+
---
8+
9+
# Update a secret scanning alert
10+
11+
Updates the status of a secret scanning alert in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the `repo` scope or `security_events` scope.
12+
13+
GitHub Apps must have the `secret_scanning_alerts` write permission to use this endpoint.
14+
15+
```js
16+
octokit.secretScanning.updateAlert({
17+
owner,
18+
repo,
19+
alert_number,
20+
state,
21+
});
22+
```
23+
24+
## Parameters
25+
26+
<table>
27+
<thead>
28+
<tr>
29+
<th>name</th>
30+
<th>required</th>
31+
<th>description</th>
32+
</tr>
33+
</thead>
34+
<tbody>
35+
<tr><td>owner</td><td>yes</td><td>
36+
37+
</td></tr>
38+
<tr><td>repo</td><td>yes</td><td>
39+
40+
</td></tr>
41+
<tr><td>alert_number</td><td>yes</td><td>
42+
43+
The security alert number, found at the end of the security alert's URL.
44+
45+
</td></tr>
46+
<tr><td>state</td><td>yes</td><td>
47+
48+
Sets the state of the secret scanning alert. Can be either `open` or `resolved`. You must provide `resolution` when you set the state to `resolved`.
49+
50+
</td></tr>
51+
<tr><td>resolution</td><td>no</td><td>
52+
53+
**Required when the `state` is `resolved`.** The reason for resolving the alert. Can be one of `false_positive`, `wont_fix`, `revoked`, or `used_in_tests`.
54+
55+
</td></tr>
56+
</tbody>
57+
</table>
58+
59+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/secret-scanning#update-a-secret-scanning-alert).

package-lock.json

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

0 commit comments

Comments
 (0)