Skip to content

Commit

Permalink
Fall back to release task assignee ID if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Mar 6, 2024
1 parent a8aef2e commit d11876a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
17 changes: 12 additions & 5 deletions .github/actions/asana-create-action-item/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inputs:
outputs:
assignee-id:
description: "Assignee ID"
value: ${{ steps.get-asana-user-id.outputs.user-id }}
value: ${{ steps.set-assignee-id.outputs.assignee-id }}
new-task-id:
description: "New task ID"
value: ${{ steps.create-task.outputs.new-task-id }}
Expand All @@ -49,11 +49,18 @@ runs:
access-token: ${{ inputs.access-token }}
github-handle: ${{ github.actor }}

- id: set-assignee-id
shell: bash
env:
USER_ID: ${{ steps.get-asana-user-id.outputs.user-id || steps.get-automation-subtask.outputs.assignee-id }}
run: |
echo "ASSIGNEE_ID=${USER_ID}" >> $GITHUB_OUTPUT
- id: process-template-payload
if: ${{ inputs.template-name }}
shell: bash
env:
ASSIGNEE_ID: ${{ steps.get-asana-user-id.outputs.user-id }}
ASSIGNEE_ID: ${{ steps.set-assignee-id.outputs.assignee-id }}
AUTOMATION_TASK_ID: ${{ steps.get-automation-subtask.outputs.automation-task-id }}
TEMPLATE_PATH: ${{ github.action_path }}/templates/${{ inputs.template-name }}.yml
WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Expand All @@ -71,7 +78,7 @@ runs:
if: ${{ inputs.notes }}
shell: bash
env:
ASSIGNEE_ID: ${{ steps.get-asana-user-id.outputs.user-id }}
ASSIGNEE_ID: ${{ steps.set-assignee-id.outputs.assignee-id }}
AUTOMATION_TASK_ID: ${{ steps.get-automation-subtask.outputs.automation-task-id }}
NOTES: ${{ inputs.notes }}
TASK_NAME: ${{ inputs.task-name }}
Expand All @@ -84,7 +91,7 @@ runs:
if: ${{ inputs.html-notes }}
shell: bash
env:
ASSIGNEE_ID: ${{ steps.get-asana-user-id.outputs.user-id }}
ASSIGNEE_ID: ${{ steps.set-assignee-id.outputs.assignee-id }}
AUTOMATION_TASK_ID: ${{ steps.get-automation-subtask.outputs.automation-task-id }}
HTML_NOTES: ${{ inputs.html-notes }}
TASK_NAME: ${{ inputs.task-name }}
Expand All @@ -97,7 +104,7 @@ runs:
shell: bash
env:
ASANA_ACCESS_TOKEN: ${{ inputs.access-token }}
ASSIGNEE_ID: ${{ steps.get-asana-user-id.outputs.user-id }}
ASSIGNEE_ID: ${{ steps.set-assignee-id.outputs.assignee-id }}
TASK_ID: ${{ steps.get-automation-subtask.outputs.automation-task-id }}
PAYLOAD_BASE64: ${{ steps.process-template-payload.outputs.payload-base64 || steps.process-notes-payload.outputs.payload-base64 || steps.process-html-notes-payload.outputs.payload-base64 }}
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ outputs:
automation-task-id:
description: "Automation task ID"
value: ${{ steps.extract-automation-task-id.outputs.automation-task-id }}
assignee-id:
description: "Release task assignee ID"
value: ${{ steps.extract-assignee-id.outputs.assignee-id }}
runs:
using: "composite"
steps:
Expand All @@ -22,6 +25,12 @@ runs:
task-url: ${{ inputs.task-url }}
access-token: ${{ inputs.access-token }}

- id: extract-assignee-id
uses: ./.github/actions/asana-extract-task-assignee
with:
task-id: ${{ steps.extract-task-id.outputs.task-id }}
access-token: ${{ inputs.access-token }}

- id: extract-automation-task-id
run: |
task_id="${{ steps.extract-task-id.outputs.task-id }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/asana-log-message/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ runs:
shell: bash
env:
ASANA_ACCESS_TOKEN: ${{ inputs.access-token }}
ASSIGNEE_ID: ${{ steps.get-asana-user-id.outputs.user-id }}
ASSIGNEE_ID: ${{ steps.get-asana-user-id.outputs.user-id || steps.get-automation-subtask.outputs.assignee-id }}
TASK_ID: ${{ steps.get-automation-subtask.outputs.automation-task-id }}
run: |
return_code=$(curl -fLSs "https://app.asana.com/api/1.0/tasks/${TASK_ID}/addFollowers" \
Expand Down

0 comments on commit d11876a

Please sign in to comment.