Skip to content

Commit

Permalink
ci: correctly handle categories (#6943)
Browse files Browse the repository at this point in the history
  • Loading branch information
itaysk authored Jun 19, 2024
1 parent 0af5730 commit eb6d0d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/actions/trivy-triage/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module.exports = {
const category = discussion.category.name;
const body = discussion.body;
if (category !== "Ideas") {
consolt.log("skipping discussion with category ${category} and body ${body}");
console.log(`skipping discussion with category ${category} and body ${body}`);
return [];
}
const scannerPattern = /### Scanner\n\n(.+)/;
const scannerFound = body.match(scannerPattern);
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/trivy-triage/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,15 @@ describe('trivy-triage', async function() {
assert(!labels.includes('FilesystemLabel'));
assert(!labels.includes('MisconfigurationLabel'));
});
it('process only relevant categories', async function() {
const discussion = {
body: 'hello world',
category: {
name: 'Announcements'
}
};
const labels = detectDiscussionLabels(discussion, configDiscussionLabels);
assert(labels.length === 0);
});
});
});

0 comments on commit eb6d0d9

Please sign in to comment.