type Github = {
token: string;
};
/**
* Update a secret scanning alert
* Updates the status of a secret scanning alert in an eligible repository.
To use this endpoint, you must be an administrator for the repository or for the organization that owns the repository, and you must use a personal access token with the `repo` scope or `security_events` scope.
For public repositories, you may instead use the `public_repo` scope.
GitHub Apps must have the `secret_scanning_alerts` write permission to use this endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
alert_number: string,
body: {
resolution?:
| null
| "false_positive"
| "wont_fix"
| "revoked"
| "used_in_tests";
resolution_comment?: string;
state: "open" | "resolved";
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/secret-scanning/alerts/${alert_number}`
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Update a secret scanning alert
* Updates the status of a secret scanning alert in an eligible repository.
To use this endpoint, you must be an administrator for the repository or for the organization that owns the repository, and you must use a personal access token with the `repo` scope or `security_events` scope.
For public repositories, you may instead use the `public_repo` scope.
GitHub Apps must have the `secret_scanning_alerts` write permission to use this endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
alert_number: string,
body: {
resolution?:
| null
| "false_positive"
| "wont_fix"
| "revoked"
| "used_in_tests";
resolution_comment?: string;
state: "open" | "resolved";
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/secret-scanning/alerts/${alert_number}`
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 927 days ago