From 27c695f31b72d31ba5e238e4573600c00a0568a5 Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Sat, 23 Oct 2021 10:01:53 -0500 Subject: [PATCH 1/2] Bumped probot version to 10.8.1 --- reporting/compensation-bot/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reporting/compensation-bot/package.json b/reporting/compensation-bot/package.json index 109bcaa..6b2d077 100644 --- a/reporting/compensation-bot/package.json +++ b/reporting/compensation-bot/package.json @@ -21,7 +21,7 @@ "test:watch": "jest --watch --notify --notifyMode=change --coverage" }, "dependencies": { - "probot": "^9.5.3", + "probot": "^10.8.1", "xmlhttprequest": "^1.8.0" }, "devDependencies": { From 94782ce03f7347088249d6dcd3e8dbcc00cdfbef Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Sat, 23 Oct 2021 10:03:16 -0500 Subject: [PATCH 2/2] Handle nobot label for issues not to be parsed; fix bug with BSQ rate announcement sticky parsing --- reporting/compensation-bot/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/reporting/compensation-bot/index.js b/reporting/compensation-bot/index.js index 75c4ef3..9d41ff8 100644 --- a/reporting/compensation-bot/index.js +++ b/reporting/compensation-bot/index.js @@ -70,12 +70,18 @@ module.exports = app => { app.log("safeMode: " + safeMode); app.log("================ ISSUE # " + context.payload.issue.number + " ====================="); - var isRATE = /^BSQ rate for cycle/gi.test(context.payload.issue.title); + var isRATE = /BSQ rate for cycle/gi.test(context.payload.issue.title); if (isRATE) { app.log("issue is BSQ rate sticky, therefore not parsing as a comp request"); return false; } + if (isIssueNobot(context)) { + app.log("issue is labeled nobot, therefore not parsing as a comp request"); + applyLabels(context, [], /^parsed:/g); // remove any pre-existing bot labels due to the nobot tag + return false; + } + // parse and log the CR so we can see in the logs what's going on crParser.parseContributionRequest(context.payload.issue.body); app.log(crParser.writeLinterSummary()); @@ -100,6 +106,13 @@ module.exports = app => { return (existingLabels.indexOf("was:accepted") >= 0); } + function isIssueNobot(context) { + let existingLabels = []; + var labelObjs = context.payload.issue.labels; + labelObjs.map(label => existingLabels.push(label.name)); + return (existingLabels.indexOf("nobot") >= 0); + } + function applyLabels(context, labelsRequired, regexFilter) { let existingLabels = []; var labelObjs = context.payload.issue.labels;