Skip to content

Commit

Permalink
fix: check milestone exists
Browse files Browse the repository at this point in the history
  • Loading branch information
federico-po committed Sep 5, 2022
1 parent bd11877 commit 6ae35db
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,17 @@ const utils = (core, github, githubToken, asanaToken) => {
githubMilestoneRegex,
asanaMilestoneRegex,
}) => {
const ghMilestone = githubMilestoneRegex.exec(milestone)[0]
if (!ghMilestone) {
const ghMilestoneRg = githubMilestoneRegex.exec(milestone)
if (!ghMilestoneRg) {
// regex doesn't match
return null
}
const ghMilestone = ghMilestoneRg[0]

return field.enum_options.find(
(opt) => asanaMilestoneRegex.exec(opt.name)[0] === ghMilestone,
)
return field.enum_options.find((opt) => {
const asanaMilestone = asanaMilestoneRegex.exec(opt.name)
return asanaMilestone && asanaMilestone[0] === ghMilestone
})
}

const getNewPRBody = (body, tasks, commentPrefixes) => {
Expand Down

0 comments on commit 6ae35db

Please sign in to comment.