Skip to content

Commit 5819d6a

Browse files
authored
feat: octokit.codeScanning.listRecentAnalyses, octokit.codeScanning.updateAlert, octokit.codeScanning.uploadSarif. Deprecation: alert_id parameter has been deprecated. Use alert_number instead (#217)
1 parent 5b97302 commit 5819d6a

21 files changed

+832
-255
lines changed

docs/actions/createOrUpdateOrgSecret.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def encrypt(public_key: str, secret_value: str) -> str:
5252
return b64encode(encrypted).decode("utf-8")
5353
```
5454

55-
#### Example encrypting a secret using C
55+
#### Example encrypting a secret using C#
5656

5757
Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.
5858

docs/actions/createOrUpdateRepoSecret.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def encrypt(public_key: str, secret_value: str) -> str:
5252
return b64encode(encrypted).decode("utf-8")
5353
```
5454

55-
#### Example encrypting a secret using C
55+
#### Example encrypting a secret using C#
5656

5757
Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.
5858

docs/codeScanning/getAlert.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
---
22
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}
3+
example: octokit.codeScanning.getAlert({ owner, repo })
4+
route: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}
55
scope: codeScanning
66
type: API method
77
---
88

99
# Get a code scanning alert
1010

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`.
11+
Gets a single code scanning alert. For private repos, you must use an access token with the `repo` scope. For public repos, you must use an access token with `public_repo` and `repo:security_events` scopes.
12+
GitHub Apps must have the `security_events` read permission to use this endpoint.
1413

1514
```js
1615
octokit.codeScanning.getAlert({
1716
owner,
1817
repo,
19-
alert_id,
2018
});
2119
```
2220

@@ -37,7 +35,12 @@ octokit.codeScanning.getAlert({
3735
<tr><td>repo</td><td>yes</td><td>
3836

3937
</td></tr>
40-
<tr><td>alert_id</td><td>yes</td><td>
38+
<tr><td>alert_number</td><td>no</td><td>
39+
40+
The code scanning alert number.
41+
42+
</td></tr>
43+
<tr><td>alert_id</td><td>no</td><td>
4144

4245
</td></tr>
4346
</tbody>

docs/codeScanning/listAlertsForRepo.md

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

99
# List code scanning alerts for a repository
1010

11-
Lists all open code scanning alerts for the default branch (usually `master`) and protected branches in 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.
11+
Lists all open code scanning alerts for the default branch (usually `master`) and protected branches in a repository. For private repos, you must use an access token with the `repo` scope. For public repos, you must use an access token with `public_repo` and `repo:security_events` scopes. GitHub Apps must have the `security_events` read permission to use this endpoint.
1212

1313
```js
1414
octokit.codeScanning.listAlertsForRepo({
@@ -36,12 +36,12 @@ octokit.codeScanning.listAlertsForRepo({
3636
</td></tr>
3737
<tr><td>state</td><td>no</td><td>
3838

39-
Set to `closed` to list only closed code scanning alerts.
39+
Set to `open`, `fixed`, or `dismissed` to list code scanning alerts in a specific state.
4040

4141
</td></tr>
4242
<tr><td>ref</td><td>no</td><td>
4343

44-
Returns a list of code scanning alerts for a specific brach reference. The `ref` must be formatted as `heads/<branch name>`.
44+
Set a full Git reference to list alerts for a specific branch. The `ref` must be formatted as `refs/heads/<branch name>`.
4545

4646
</td></tr>
4747
</tbody>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: List recent code scanning analyses for a repository
3+
example: octokit.codeScanning.listRecentAnalyses({ owner, repo })
4+
route: GET /repos/{owner}/{repo}/code-scanning/analyses
5+
scope: codeScanning
6+
type: API method
7+
---
8+
9+
# List recent code scanning analyses for a repository
10+
11+
List the details of recent code scanning analyses for a repository. For private repos, you must use an access token with the `repo` scope. For public repos, you must use an access token with `public_repo` and `repo:security_events` scopes. GitHub Apps must have the `security_events` read permission to use this endpoint.
12+
13+
```js
14+
octokit.codeScanning.listRecentAnalyses({
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+
</td></tr>
34+
<tr><td>repo</td><td>yes</td><td>
35+
36+
</td></tr>
37+
<tr><td>ref</td><td>no</td><td>
38+
39+
Set a full Git reference to list alerts for a specific branch. The `ref` must be formatted as `refs/heads/<branch name>`.
40+
41+
</td></tr>
42+
<tr><td>tool_name</td><td>no</td><td>
43+
44+
Set a single code scanning tool name to filter alerts by tool.
45+
46+
</td></tr>
47+
</tbody>
48+
</table>
49+
50+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/code-scanning/#list-recent-analyses).

docs/codeScanning/updateAlert.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Update a code scanning alert
3+
example: octokit.codeScanning.updateAlert({ owner, repo, state })
4+
route: PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}
5+
scope: codeScanning
6+
type: API method
7+
---
8+
9+
# Update a code scanning alert
10+
11+
Updates the status of a single code scanning alert. For private repos, you must use an access token with the `repo` scope. For public repos, you must use an access token with `public_repo` and `repo:security_events` scopes.
12+
GitHub Apps must have the `security_events` write permission to use this endpoint.
13+
14+
```js
15+
octokit.codeScanning.updateAlert({
16+
owner,
17+
repo,
18+
state,
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>alert_number</td><td>no</td><td>
40+
41+
The code scanning alert number.
42+
43+
</td></tr>
44+
<tr><td>state</td><td>yes</td><td>
45+
46+
Sets the state of the code scanning alert. Can be one of `open` or `dismissed`. You must provide `dismissed_reason` when you set the state to `dismissed`.
47+
48+
</td></tr>
49+
<tr><td>dismissed_reason</td><td>no</td><td>
50+
51+
**Required when the state is dismissed.** The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`.
52+
53+
</td></tr>
54+
</tbody>
55+
</table>
56+
57+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/code-scanning/#upload-a-code-scanning-alert).

docs/codeScanning/uploadSarif.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
name: Upload a SARIF file
3+
example: octokit.codeScanning.uploadSarif({ owner, repo, commit_sha, ref, sarif, tool_name })
4+
route: POST /repos/{owner}/{repo}/code-scanning/sarifs
5+
scope: codeScanning
6+
type: API method
7+
---
8+
9+
# Upload a SARIF file
10+
11+
Upload a SARIF file containing the results of a code scanning analysis to make the results available in a repository.
12+
For private repos, you must use an access token with the `repo` scope. For public repos, you must use an access token with `public_repo` and `repo:security_events` scopes. GitHub Apps must have the `security_events` write permission to use this endpoint.
13+
14+
```js
15+
octokit.codeScanning.uploadSarif({
16+
owner,
17+
repo,
18+
commit_sha,
19+
ref,
20+
sarif,
21+
tool_name,
22+
});
23+
```
24+
25+
## Parameters
26+
27+
<table>
28+
<thead>
29+
<tr>
30+
<th>name</th>
31+
<th>required</th>
32+
<th>description</th>
33+
</tr>
34+
</thead>
35+
<tbody>
36+
<tr><td>owner</td><td>yes</td><td>
37+
38+
</td></tr>
39+
<tr><td>repo</td><td>yes</td><td>
40+
41+
</td></tr>
42+
<tr><td>commit_sha</td><td>yes</td><td>
43+
44+
The commit SHA of the code scanning analysis file.
45+
46+
</td></tr>
47+
<tr><td>ref</td><td>yes</td><td>
48+
49+
The full Git reference of the code scanning analysis file, formatted as `refs/heads/<branch name>`.
50+
51+
</td></tr>
52+
<tr><td>sarif</td><td>yes</td><td>
53+
54+
A Base64 string representing the SARIF file to upload. You must first compress your SARIF file using [`gzip`](http://www.gnu.org/software/gzip/manual/gzip.html) and then translate the contents of the file into a Base64 encoding string.
55+
56+
</td></tr>
57+
<tr><td>checkout_uri</td><td>no</td><td>
58+
59+
The base directory used in the analysis, as it appears in the SARIF file.
60+
This property is used to convert file paths from absolute to relative, so that alerts can be mapped to their correct location in the repository.
61+
62+
</td></tr>
63+
<tr><td>started_at</td><td>no</td><td>
64+
65+
The time that the analysis run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
66+
67+
</td></tr>
68+
<tr><td>tool_name</td><td>yes</td><td>
69+
70+
The name of the tool used to generate the code scanning analysis alert.
71+
72+
</td></tr>
73+
</tbody>
74+
</table>
75+
76+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/code-scanning/#upload-a-sarif-analysis).

docs/git/createCommit.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ type: API method
1010

1111
Creates a new Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects).
1212

13-
In this example, the payload of the signature would be:
14-
1513
**Signature verification object**
1614

1715
The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:
1816

17+
| Name | Type | Description |
18+
| ----------- | --------- | ------------------------------------------------------------------------------------------------ |
19+
| `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. |
20+
| `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. |
21+
| `signature` | `string` | The signature that was extracted from the commit. |
22+
| `payload` | `string` | The value that was signed. |
23+
1924
These are the possible values for `reason` in the `verification` object:
2025

2126
| Value | Description |

docs/git/createTag.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ Note that creating a tag object does not create the reference that makes a tag i
1414

1515
The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:
1616

17+
| Name | Type | Description |
18+
| ----------- | --------- | ------------------------------------------------------------------------------------------------ |
19+
| `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. |
20+
| `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. |
21+
| `signature` | `string` | The signature that was extracted from the commit. |
22+
| `payload` | `string` | The value that was signed. |
23+
1724
These are the possible values for `reason` in the `verification` object:
1825

1926
| Value | Description |

docs/git/getCommit.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ Gets a Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Obje
1414

1515
The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:
1616

17+
| Name | Type | Description |
18+
| ----------- | --------- | ------------------------------------------------------------------------------------------------ |
19+
| `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. |
20+
| `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. |
21+
| `signature` | `string` | The signature that was extracted from the commit. |
22+
| `payload` | `string` | The value that was signed. |
23+
1724
These are the possible values for `reason` in the `verification` object:
1825

1926
| Value | Description |

0 commit comments

Comments
 (0)