diff --git a/.github/scripts/trigger-and-wait.sh b/.github/scripts/trigger-and-wait.sh index c07c4902d..08e0a51d5 100644 --- a/.github/scripts/trigger-and-wait.sh +++ b/.github/scripts/trigger-and-wait.sh @@ -87,11 +87,14 @@ trigger_workflow() { -H "Content-Type: application/json" \ -H "Authorization: Bearer ${INPUT_GITHUB_TOKEN}" \ --data "{\"ref\":\"${ref}\",\"inputs\":${inputs}}" + + # Sleep after triggering workflow so it can be polled for status + echo "Sleeping for $wait_interval seconds" + sleep $wait_interval } wait_for_workflow_to_finish() { # Find the id of the last build - sleep "${wait_interval}" # Let workflow be triggered before fetching the latest workflow last_workflow=$(curl -X GET "https://api.github.com/repos/${INPUT_OWNER}/${INPUT_REPO}/actions/workflows/${INPUT_WORKFLOW_FILE_NAME}/runs" \ -H 'Accept: application/vnd.github.antiope-preview+json' \ -H "Authorization: Bearer ${INPUT_GITHUB_TOKEN}" | jq '[.workflow_runs[]] | first')