Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

[WIP] Proposal to add a checkbox for "Is this a regression" #1

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions danger/regressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,30 @@ declare const peril: any // danger/danger#351
const gh = danger.github as any as Issues
const issue = gh.issue
const repo = gh.repository
const text = (issue.title + issue.body).toLowerCase()
var text = (issue.title + issue.body).toLowerCase()
const api = danger.github.api

if (text.includes("regression")) {
const startMarker = "<!-- start regression question -->"
const endMarker = "<!-- end regression question -->"

var start = text.indexOf(startMarker);
var end = text.indexOf(endMarker)

var hasRegressionChecked = false;

if (start !== -1 && end !== -1) {
end = end + endMarker.length

var regressionQuestion = text.substring(start, end);
text = text.replace(regressionQuestion, '');

if (regressionQuestion.includes("- [x] yes")) {
hasRegressionChecked = true;
}
}

if (hasRegressionChecked || text.includes("regression")) {
console.log("IT HAS A REGRESSION");
var url = peril.env.SLACK_WEBHOOK_URL || "";
var webhook = new IncomingWebhook(url);
schedule( async () => {
Expand Down
3 changes: 1 addition & 2 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"modules": ["@slack/client"]
},
"rules": {
// https://artsy.github.io/blog/2017/09/04/Introducing-Peril/#Events
"issues.opened": "fastlane/peril-settings@danger/regressions.ts"
"issues.opened": "joshdholtz/peril-settings@danger/regressions.ts"
}
}