Add check #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |