Skip to content

Commit

Permalink
1.0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
max-mapper committed May 11, 2021
1 parent 5756bf6 commit 0a3139d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Asana Github Pull Request Link
uses: ExodusMovement/[email protected].19
uses: ExodusMovement/[email protected].20
with:
token: ${{ secrets.ASANA_TOKEN }}
workspace: ${{ secrets.ASANA_WORKSPACE_ID }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Asana Github Pull Request Link
uses: ExodusMovement/[email protected].19
uses: ExodusMovement/[email protected].20
with:
token: ${{ secrets.ASANA_TOKEN }}
workspace: ${{ secrets.ASANA_WORKSPACE_ID }}
Expand Down
12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ const run = async () => {
}

const lookupTask = async () => {
if (!shortId) return core.info('no matching asana short id in: ' + pr.title)
else core.info('searching for short id: ' + shortId)

if (!shortId) {
core.info('no matching asana short id in: ' + pr.title)
return
} else {
core.info('searching for short id: ' + shortId)
}

const task = await asana.getMatchingAsanaTask(asana_token, workspace, shortId)

if (task) core.info('got matching task: ' + JSON.stringify(task))
Expand All @@ -31,6 +35,7 @@ const run = async () => {
if (action === 'opened' || action === 'edited') {
if (pr.body.indexOf(commentPrefix) === -1) {
const task = await lookupTask()
if (!task) return
const link = `This PR is linked to [this Asana task.](https://app.asana.com/0/${workspace}/${task.gid})`
const newBody = pr.body += '\n\n' + commentPrefix + link

Expand All @@ -49,6 +54,7 @@ const run = async () => {
}
} else if (action === 'closed' && pr.merged) {
const task = await lookupTask()
if (!task) return
await asana.completeAsanaTask(asana_token, workspace, task.gid)
}
} catch (err) {
Expand Down

0 comments on commit 0a3139d

Please sign in to comment.