forked from kamilchodola/wait-for-workflow-action
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (46 loc) · 1.44 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Test WaitForWorkflow
on:
push:
branches:
- main
workflow_dispatch:
inputs:
ref:
description: 'branch'
required: false
default: ''
run_id:
description: 'run_id for test'
required: false
default: ''
jobs:
test_workflow_dispatch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Trigger another workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: to_be_triggered.yml
token: ${{ secrets.GITHUB_TOKEN }}
ref: "${{ inputs.ref || github.ref }}"
- name: Wait for the triggered workflow to complete
run: |
chmod +x scripts/wait-for-workflow.sh
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
export WORKFLOW_NAME="to_be_triggered.yml"
export RUN_ID="${{ inputs.run_id }}"
export MAX_WAIT="2"
export INTERVAL="5"
export TIMEOUT="5"
export REPOSITORY="${{ github.repository }}"
export REF="${{ inputs.ref || github.ref }}"
export VERBOSE="true"
./scripts/wait-for-workflow.sh
echo "Run ID: $WORKFLOW_RUN_ID"
echo "Conclusion: $WORKFLOW_CONCLUSION"
if [ -z "$WORKFLOW_RUN_ID" ] || [ -z "$WORKFLOW_CONCLUSION" ]; then
echo "Failed to get workflow run ID or conclusion";
exit 1;
fi