Skip to content

Commit

Permalink
refactor: title assignment (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygriffiths authored Dec 13, 2021
1 parent db7ee0b commit 467f00e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const github = require('@actions/github');
try {
const issuekey = core.getInput('issuekey').toLowerCase().replace(/ /g, '')
const keyarr = issuekey.split(',')
if (github.context.payload && github.context.payload.pull_request) {
var title = github.context.payload.pull_request.title
title = title.toLowerCase()
}
core.info(title)
var passed = false
for (let i = 0; i < keyarr.length; i++) {
const pattern = '^(build|ci|chore|docs|feat|fix|perf|refactor|revert|style|task|test)(.*)(:\\s)(' + keyarr[i] + '-\\d+\\s*|none)+(:)'
const regex = new RegExp(pattern)
if (github.context.payload && github.context.payload.pull_request) {
var title = github.context.payload.pull_request.title
title = title.toLowerCase()
}
core.info(title)
if (regex.test(title)) {
passed = true
}
Expand Down

0 comments on commit 467f00e

Please sign in to comment.