Skip to content

Improve

Improve #6

Workflow file for this run

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: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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
id: wait-for-workflow
uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
workflow_name: to_be_triggered.yml
run_id: "${{ inputs.run_id }}"
max_wait: 2
interval: 10
timeout: 5
repository: ${{ github.repository }}
ref: "${{ inputs.ref || github.ref }}"
verbose: true
- name: Print the workflow run ID and conclusion
run: |
run_id=$(echo "${{ steps.wait-for-workflow.outputs.run_id }}")
conclusion=$(echo "${{ steps.wait-for-workflow.outputs.conclusion }}")
echo "Run ID: $run_id"
echo "Conclusion: $conclusion"
if [ -z "$run_id" ] || [ -z "$conclusion" ]; then
echo "Failed to get workflow run ID and/or conclusion";
exit 1;
fi