ci: correctly handle categories (#6943)

This commit is contained in:
Itay Shakury
2024-06-19 07:58:23 +03:00
committed by GitHub
parent 0af5730cbe
commit eb6d0d9779
2 changed files with 12 additions and 1 deletions

View File

@@ -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);

View File

@@ -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);
});
});
});