Skip to content
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
30 changes: 30 additions & 0 deletions org/labelissue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { danger, schedule } from "danger"

const gh = danger.github as any
const issue = gh.issue
const repo = gh.repository

const qWords: string[] = ["how", "who", "what", "where", "when", "why", "which"]

if (issue.title.slice(-1) == "?") {
addLabel()
} else {
const title = issue.title.toLowerCase()
for (var i = 0; i < qWords.length; i++) {
if (title.startsWith(qWords[i])) {
addLabel()
break
}
}
}

function addLabel() {
schedule(async () => {
await danger.github.api.issues.addLabels({
owner: repo.owner.login,
repo: repo.name,
number: issue.number,
labels: ["question"],
})
})
}
6 changes: 3 additions & 3 deletions settings-peril.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
},
"rules": {
"pull_request": "RxSwiftCommunity/peril@org/all-prs.ts",
"pull_request.closed": "RxSwiftCommunity/peril@org/aeryn.ts",
"issue": "RxSwiftCommunity/peril@org/all-issues.ts",
"pull_request.closed": "RxSwiftCommunity/peril@org/aeryn.ts"
"issue.opened": "RxSwiftCommunity/peril@org/labelissue.ts"
},
"repos": {
}
"repos": {}
}