From d11876ae04a7aaa1325a92f916b2f5c120dcbd9a Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Wed, 6 Mar 2024 21:55:41 +0100 Subject: [PATCH] Fall back to release task assignee ID if needed --- .../actions/asana-create-action-item/action.yml | 17 ++++++++++++----- .../action.yml | 9 +++++++++ .github/actions/asana-log-message/action.yml | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/actions/asana-create-action-item/action.yml b/.github/actions/asana-create-action-item/action.yml index 150e7f52ae..7811660f41 100644 --- a/.github/actions/asana-create-action-item/action.yml +++ b/.github/actions/asana-create-action-item/action.yml @@ -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 }} @@ -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 }} @@ -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 }} @@ -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 }} @@ -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: | diff --git a/.github/actions/asana-get-release-automation-subtask-id/action.yml b/.github/actions/asana-get-release-automation-subtask-id/action.yml index a7721a7043..f692570445 100644 --- a/.github/actions/asana-get-release-automation-subtask-id/action.yml +++ b/.github/actions/asana-get-release-automation-subtask-id/action.yml @@ -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: @@ -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 }}" diff --git a/.github/actions/asana-log-message/action.yml b/.github/actions/asana-log-message/action.yml index c95558fc3f..7ab78fdd4b 100644 --- a/.github/actions/asana-log-message/action.yml +++ b/.github/actions/asana-log-message/action.yml @@ -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" \