Skip to content

Commit

Permalink
chore: wait until other workflow complete
Browse files Browse the repository at this point in the history
  • Loading branch information
chintankavathia committed Nov 22, 2024
1 parent 60a2a44 commit d45bf2b
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,43 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $PAT" \
https://api.github.com/repos/chintankavathia/siemens-datatable/actions/workflows/test_and_deploy.yml/dispatches \
-d '{"ref":"test/setup-playwright"}'
-d '{"ref":"main"}'
- name: Wait for Repository Siemens Datatable Workflow Completion
id: wait_workflow
env:
PAT: ${{ secrets.PLAYWRIGHT }}
run: |
STATUS="in_progress"
CHECK_INTERVAL=30
RUN_ID=""
echo "Polling for workflow status..."
while [ "$STATUS" = "in_progress" ] || [ "$STATUS" = "queued" ]; do
sleep $CHECK_INTERVAL
# Fetch latest workflow runs for Repository B
RESPONSE=$(curl -s -H "Authorization: token $PAT" \
"https://api.github.com/repos/chintankavathia/siemens-datatable/actions/runs?branch=main&status=in_progress")
RUN_ID=$(echo $RESPONSE | jq -r '.workflow_runs[0].id')
STATUS=$(echo $RESPONSE | jq -r '.workflow_runs[0].status')
done
if [ "$STATUS" != "completed" ]; then
echo "Repository Siemens Datatable workflow failed or was cancelled"
exit 1
fi
CONCLUSION=$(curl -s -H "Authorization: token $PAT" \
"https://api.github.com/repos/chintankavathia/siemens-datatable/actions/runs/$RUN_ID" | jq -r '.conclusion')
if [ "$CONCLUSION" != "success" ]; then
echo "Repository Siemens Datatable workflow failed with conclusion: $CONCLUSION"
exit 1
fi
echo "Repository Siemens Datatable workflow completed successfully"
- name: Build Docs
run: |
Expand Down

0 comments on commit d45bf2b

Please sign in to comment.