Skip to content

Commit

Permalink
feat: `octokit.secretScanning.{getAlert,listAlertsForRepo,updateAlert…
Browse files Browse the repository at this point in the history
…}` (#298)

Co-authored-by: Gregor Martynus <[email protected]>
  • Loading branch information
octokitbot and gr2m authored Dec 3, 2020
1 parent 788c8a8 commit e01de33
Show file tree
Hide file tree
Showing 13 changed files with 539 additions and 66 deletions.
2 changes: 0 additions & 2 deletions docs/actions/getWorkflowRunUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ type: API method

# Get workflow run usage

**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)."

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)".

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.
Expand Down
2 changes: 0 additions & 2 deletions docs/actions/getWorkflowUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ type: API method

# Get workflow usage

**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)."

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)".

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.
Expand Down
2 changes: 1 addition & 1 deletion docs/codeScanning/updateAlert.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.codeScanning.updateAlert({
</td></tr>
<tr><td>alert_number</td><td>yes</td><td>

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

</td></tr>
<tr><td>state</td><td>yes</td><td>
Expand Down
45 changes: 0 additions & 45 deletions docs/repos/getRepoPermissions.md

This file was deleted.

48 changes: 48 additions & 0 deletions docs/secretScanning/getAlert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Get a secret scanning alert
example: octokit.secretScanning.getAlert({ owner, repo, alert_number })
route: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}
scope: secretScanning
type: API method
---

# Get a secret scanning alert

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.

GitHub Apps must have the `secret_scanning_alerts` read permission to use this endpoint.

```js
octokit.secretScanning.getAlert({
owner,
repo,
alert_number,
});
```

## Parameters

<table>
<thead>
<tr>
<th>name</th>
<th>required</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr><td>owner</td><td>yes</td><td>

</td></tr>
<tr><td>repo</td><td>yes</td><td>

</td></tr>
<tr><td>alert_number</td><td>yes</td><td>

The security alert number, found at the end of the security alert's URL.

</td></tr>
</tbody>
</table>

See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/secret-scanning#get-a-secret-scanning-alert).
57 changes: 57 additions & 0 deletions docs/secretScanning/listAlertsForRepo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: List secret scanning alerts for a repository
example: octokit.secretScanning.listAlertsForRepo({ owner, repo })
route: GET /repos/{owner}/{repo}/secret-scanning/alerts
scope: secretScanning
type: API method
---

# List secret scanning alerts for a repository

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.

GitHub Apps must have the `secret_scanning_alerts` read permission to use this endpoint.

```js
octokit.secretScanning.listAlertsForRepo({
owner,
repo,
});
```

## Parameters

<table>
<thead>
<tr>
<th>name</th>
<th>required</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr><td>owner</td><td>yes</td><td>

</td></tr>
<tr><td>repo</td><td>yes</td><td>

</td></tr>
<tr><td>state</td><td>no</td><td>

Set to `open` or `resolved` to only list secret scanning alerts in a specific state.

</td></tr>
<tr><td>page</td><td>no</td><td>

Page number of the results to fetch.

</td></tr>
<tr><td>per_page</td><td>no</td><td>

Results per page (max 100)

</td></tr>
</tbody>
</table>

See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/secret-scanning#list-secret-scanning-alerts-for-a-repository).
59 changes: 59 additions & 0 deletions docs/secretScanning/updateAlert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Update a secret scanning alert
example: octokit.secretScanning.updateAlert({ owner, repo, alert_number, state })
route: PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}
scope: secretScanning
type: API method
---

# Update a secret scanning alert

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.

GitHub Apps must have the `secret_scanning_alerts` write permission to use this endpoint.

```js
octokit.secretScanning.updateAlert({
owner,
repo,
alert_number,
state,
});
```

## Parameters

<table>
<thead>
<tr>
<th>name</th>
<th>required</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr><td>owner</td><td>yes</td><td>

</td></tr>
<tr><td>repo</td><td>yes</td><td>

</td></tr>
<tr><td>alert_number</td><td>yes</td><td>

The security alert number, found at the end of the security alert's URL.

</td></tr>
<tr><td>state</td><td>yes</td><td>

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`.

</td></tr>
<tr><td>resolution</td><td>no</td><td>

**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`.

</td></tr>
</tbody>
</table>

See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/secret-scanning#update-a-secret-scanning-alert).
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"author": "Gregor Martynus (https://twitter.com/gr2m)",
"license": "MIT",
"dependencies": {
"@octokit/types": "^6.0.3",
"@octokit/types": "^6.1.0",
"deprecation": "^2.3.1"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit e01de33

Please sign in to comment.