Skip to content

Commit

Permalink
fix: Poll workflow status for Scoop/HomeBrew (twilio#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
onuzbee committed Dec 15, 2021
1 parent d5c0a65 commit eeff221
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/scripts/trigger-and-wait.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit eeff221

Please sign in to comment.