Skip to content

Commit

Permalink
handle empty project references
Browse files Browse the repository at this point in the history
  • Loading branch information
muodov committed Mar 7, 2024
1 parent 500cbdc commit c6818a0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ci/asana-create-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,18 @@ const asanaCreateTasks = async () => {
platforms[platform].taskUrl = permalink_url

const newName = name.replace('[[version]]', version)
const projectGids = (html_notes.match(projectExtractorRegex)?.[1] || '').split(',')
const extractedProjects = html_notes.match(projectExtractorRegex)?.[1]

const subtaskNotes =
html_notes.replace(projectExtractorRegex, '')
.replace('[[notes]]', updatedNotes)

await asana.tasks.updateTask(gid, { name: newName, html_notes: subtaskNotes })

for (const projectGid of projectGids) {
await asana.tasks.addProjectForTask(gid, { project: projectGid, insert_after: null })
if (extractedProjects) {
for (const projectGid of extractedProjects.split(',')) {
await asana.tasks.addProjectForTask(gid, { project: projectGid, insert_after: null })
}
}
}

Expand Down

0 comments on commit c6818a0

Please sign in to comment.