Last active
December 4, 2019 19:13
-
-
Save jeremylenz/75ffdd02f1762c2c479635d7b18c9afd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Zap: Foreman - New RM issue from Asana magic tag | |
// Step 3: Check Asana tags for RM Tracker type | |
const { tags, assignee } = inputData; | |
let tagList = []; | |
if (tags) tagList = tags.split(","); | |
const tagNameToRM = { | |
bug: 1, | |
feature: 2, | |
refactor: 4, | |
} | |
let result = tagNameToRM.bug; // default is bug | |
// if tags include Feature or Refactor, assign trackerId accordingly | |
tagList.forEach((asanaTag) => { | |
Object.keys(tagNameToRM).forEach((rmTag) => { | |
console.log({ asanaTag, rmTag }) | |
if (asanaTag.toLowerCase().includes(rmTag)) result = tagNameToRM[rmTag]; | |
}); | |
}); | |
const tmNameToRedmineId = { | |
jeremy: 17605, | |
ron: 12600, | |
magaphon: 13438, | |
amir: 6040, | |
sharvit: 10109, | |
raines: 4225, | |
ezr: 13425, | |
}; | |
let asanaAssignee = ''; | |
if (assignee) asanaAssignee = assignee.toLowerCase(); | |
let rmUserId = ''; | |
Object.keys(tmNameToRedmineId).forEach((name) => { | |
if (asanaAssignee.includes(name)) rmUserId = tmNameToRedmineId[name]; | |
}); | |
return { | |
trackerId: result, | |
rmUserId, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment