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 | | | `token` | ✓ | [GitHub token], usually a `${{ secrets.GITHUB_TOKEN }}` | string | |
| `ignore` | | Comma-separated list of advisory ids to ignore | 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 | `.` | | `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 [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 { export interface Input {
token: string; token: string;
ignore: string[]; ignore: string[];
new_issue_labels: string[];
workingDirectory: string; workingDirectory: string;
} }
@@ -15,6 +16,10 @@ export function get(): Input {
return { return {
token: input.getInput('token', { required: true }), token: input.getInput('token', { required: true }),
ignore: input.getInputList('ignore', { required: false }), 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> { export async function run(actionInput: input.Input): Promise<void> {
const labels = actionInput.new_issue_labels;
const ignore = actionInput.ignore; const ignore = actionInput.ignore;
const workingDirectory = removeTrailingSlash(actionInput.workingDirectory); const workingDirectory = removeTrailingSlash(actionInput.workingDirectory);
const report = await getData(ignore, workingDirectory); const report = await getData(ignore, workingDirectory);
@@ -97,7 +98,12 @@ export async function run(actionInput: input.Input): Promise<void> {
core.debug( core.debug(
'Action was triggered on a schedule event, creating an Issues report', '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 { } else {
core.debug( core.debug(
`Action was triggered on a ${github.context.eventName} event, creating a Check report`, `Action was triggered on a ${github.context.eventName} event, creating a Check report`,
+2
View File
@@ -256,6 +256,7 @@ export async function reportIssues(
token: string, token: string,
vulnerabilities: Array<interfaces.Vulnerability>, vulnerabilities: Array<interfaces.Vulnerability>,
warnings: Array<interfaces.Warning>, warnings: Array<interfaces.Warning>,
labels: string[],
): Promise<void> { ): Promise<void> {
const { owner, repo } = github.context.repo; const { owner, repo } = github.context.repo;
@@ -278,6 +279,7 @@ export async function reportIssues(
repo: repo, repo: repo,
title: `${vulnerability.advisory.id}: ${vulnerability.advisory.title}`, title: `${vulnerability.advisory.id}: ${vulnerability.advisory.title}`,
body: body, body: body,
labels,
}); });
core.info( core.info(
`Created an issue for ${vulnerability.advisory.id}: ${issue.data.html_url}`, `Created an issue for ${vulnerability.advisory.id}: ${issue.data.html_url}`,