@@ -10,33 +10,23 @@ jobs:
10
10
wait_for_other_action :
11
11
runs-on : ubuntu-latest
12
12
steps :
13
- - name : Wait for Other Action to Complete
14
- id : check_status
15
- run : |
16
- # Set the necessary variables
17
- WORKFLOW_NAME="Run Headless Browser Tests"
18
- REPO="${{ github.repository }}" # Automatically get the repository name
19
- BRANCH="${{ github.ref }}" # Get the ref, which includes refs/heads/main
20
-
21
- # Loop until the workflow is complete
22
- while true; do
23
- # Query the GitHub API for the workflow run status
24
- STATUS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
25
- "https://api.github.com/repos/$REPO/actions/workflows/${WORKFLOW_NAME}/runs?branch=${BRANCH}&per_page=1" | \
26
- jq -r '.workflow_runs[0].status')
27
-
28
- # Check if the status is completed
29
- if [[ "$STATUS" == "completed" ]]; then
30
- echo "Other action is complete."
31
- break
32
- fi
33
- if [[ "$STATUS" == "failed" ]]; then
34
- echo "Other action is faild."
35
- exit 1 # Exit with error code
36
- fi
37
- echo "Waiting for other action to complete..."
38
- sleep 10 # Wait for 10 seconds before checking again
39
- done
13
+ - name : Dispatch an action and get the run ID
14
+ uses : codex-/return-dispatch@v1
15
+ id : return_dispatch
16
+ with :
17
+ token : ${{ github.token }}
18
+ repo : ${{ github.event.repository.name }}
19
+ owner : ${{ github.repository_owner }}
20
+ workflow : automation-test.yml
21
+ - name : Await Run ID ${{ steps.return_dispatch.outputs.run_id }}
22
+ uses : Codex-/await-remote-run@v1.0.0
23
+ with :
24
+ token : ${{ github.token }}
25
+ repo : ${{ github.event.repository.name }}
26
+ owner : ${{ github.repository_owner }}
27
+ run_id : ${{ steps.return_dispatch.outputs.run_id }}
28
+ run_timeout_seconds : 300 # Optional
29
+ poll_interval_ms : 5000 # Optional
40
30
41
31
build :
42
32
runs-on : ubuntu-latest
0 commit comments