2 Commits
Author SHA1 Message Date
Aaron Kelbsch 26f9009348 docs: update docs
Continuous integration / main (push) Failing after 1m43s
2025-08-25 15:52:46 +02:00
Aaron Kelbsch d8774e016c feat: allow custom labels for new issues 2025-08-25 15:50:51 +02:00
5 changed files with 20 additions and 6 deletions
+1
View File
@@ -104,6 +104,7 @@ For each new advisory (including informal) an issue will be created:
| `token` | ✓ | [GitHub token], usually a `${{ secrets.GITHUB_TOKEN }}` | string | |
| `ignore` | | Comma-separated list of advisory ids to ignore | string | |
| `working-directory`| | The directory of the Cargo.toml / Cargo.lock files to scan. | string | `.` |
| `new-issue-labels` | | Comma-separated list of Labes to be added to new issues | string | `.` |
[GitHub token]: https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
+1 -1
View File
File diff suppressed because one or more lines are too long
+6 -1
View File
@@ -8,6 +8,7 @@ import { input } from '@clechasseur/rs-actions-core';
export interface Input {
token: string;
ignore: string[];
new_issue_labels: string[];
workingDirectory: string;
}
@@ -15,6 +16,10 @@ export function get(): Input {
return {
token: input.getInput('token', { required: true }),
ignore: input.getInputList('ignore', { required: false }),
workingDirectory: input.getInput('working-directory', { required: false }) ?? '.',
new_issue_labels: input.getInputList('new-issue-labels', {
required: false,
}),
workingDirectory:
input.getInput('working-directory', { required: false }) ?? '.',
};
}
+7 -1
View File
@@ -54,6 +54,7 @@ function removeTrailingSlash(str) {
}
export async function run(actionInput: input.Input): Promise<void> {
const labels = actionInput.new_issue_labels;
const ignore = actionInput.ignore;
const workingDirectory = removeTrailingSlash(actionInput.workingDirectory);
const report = await getData(ignore, workingDirectory);
@@ -97,7 +98,12 @@ export async function run(actionInput: input.Input): Promise<void> {
core.debug(
'Action was triggered on a schedule event, creating an Issues report',
);
await reporter.reportIssues(actionInput.token, advisories, warnings);
await reporter.reportIssues(
actionInput.token,
advisories,
warnings,
labels,
);
} else {
core.debug(
`Action was triggered on a ${github.context.eventName} event, creating a Check report`,
+5 -3
View File
@@ -166,7 +166,7 @@ export async function reportCheck(
vulnerabilities: Array<interfaces.Vulnerability>,
warnings: Array<interfaces.Warning>,
): Promise<void> {
const client = github.getOctokit(token, {userAgent: USER_AGENT});
const client = github.getOctokit(token, { userAgent: USER_AGENT });
const reporter = new checks.CheckReporter(client.rest, 'Security audit');
const stats = getStats(vulnerabilities, warnings);
const summary = getSummary(stats);
@@ -235,7 +235,7 @@ async function alreadyReported(
advisoryId: string,
): Promise<boolean> {
const { owner, repo } = github.context.repo;
const client = github.getOctokit(token, {userAgent: USER_AGENT});
const client = github.getOctokit(token, { userAgent: USER_AGENT });
const results = await client.rest.search.issuesAndPullRequests({
q: `${advisoryId} in:title repo:${owner}/${repo}`,
per_page: 1, // eslint-disable-line @typescript-eslint/camelcase
@@ -256,10 +256,11 @@ export async function reportIssues(
token: string,
vulnerabilities: Array<interfaces.Vulnerability>,
warnings: Array<interfaces.Warning>,
labels: string[],
): Promise<void> {
const { owner, repo } = github.context.repo;
const client = github.getOctokit(token, {userAgent: USER_AGENT});
const client = github.getOctokit(token, { userAgent: USER_AGENT });
for (const vulnerability of vulnerabilities) {
const reported = await alreadyReported(
@@ -278,6 +279,7 @@ export async function reportIssues(
repo: repo,
title: `${vulnerability.advisory.id}: ${vulnerability.advisory.title}`,
body: body,
labels,
});
core.info(
`Created an issue for ${vulnerability.advisory.id}: ${issue.data.html_url}`,