Merge pull request #9 from PombeirP/feature/case-insensitive-label-matching

Match labels without caring about case-sensitivity
This commit is contained in:
Andy Tudhope 2018-03-20 17:20:39 +02:00 committed by GitHub
commit 6c1ccd7c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -48,7 +48,8 @@ function getAddress (req) {
async function getLabel (req) {
const labelNames = await github.getLabels(req)
const bountyLabels = labelNames.filter(labelName => config.bountyLabels.hasOwnProperty(labelName))
const upperCaseLabelNames = labelNames.map(l => l.toUpperCase())
const bountyLabels = Object.keys(config.bountyLabels).filter(bountyLabel => upperCaseLabelNames.find(l => l === bountyLabel.toUpperCase()))
if (bountyLabels.length === 1) {
return bountyLabels[0]
}