This GitHub Action allows you to trigger a workflow in a specified repository and wait for its completion. It is useful for orchestrating complex workflows that depend on the successful execution of other workflows.
- ✅ Trigger workflows in any repository you have access to
- ✅ Wait for triggered workflows to complete
- ✅ Configurable wait intervals and timeouts
- ✅ Proper error handling and failure propagation
- ✅ Optimized bundle size using
@vercel/ncc - ✅ Comprehensive test coverage
name: Trigger Workflow and Wait
on:
workflow_dispatch:
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger another workflow
uses: greedigoblins/trigger-workflow-and-wait@v1
with:
owner: 'your-github-username'
repo: 'your-repo-name'
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow_file_name: 'your-workflow-file.yml'name: Complex Workflow Orchestration
on:
push:
branches: [ main ]
jobs:
trigger-and-wait:
runs-on: ubuntu-latest
steps:
- name: Trigger deployment workflow
uses: greedigoblins/trigger-workflow-and-wait@v1
with:
owner: 'my-org'
repo: 'deployment-repo'
github_token: ${{ secrets.DEPLOY_TOKEN }}
workflow_file_name: 'deploy.yml'
wait_interval: '30' # Check every 30 seconds
propagate_failure: 'true' # Fail this job if triggered workflow fails
trigger_workflow: 'true' # Actually trigger the workflow
wait_workflow: 'true' # Wait for completion| Input | Description | Required | Default |
|---|---|---|---|
owner |
The owner of the repository | ✅ | |
repo |
The name of the repository | ✅ | |
github_token |
GitHub token with repo access | ✅ | |
workflow_file_name |
The name of the workflow file to trigger | ✅ | |
wait_interval |
The interval to wait between checks (in seconds) | ❌ | 10 |
propagate_failure |
Whether to propagate failure to the upstream job | ❌ | true |
trigger_workflow |
Whether to trigger the workflow | ❌ | true |
wait_workflow |
Whether to wait for the workflow to finish | ❌ | true |
| Output | Description |
|---|---|
workflow_id |
The ID of the triggered workflow |
workflow_url |
The URL of the triggered workflow |
This action uses automated releases with GitHub Actions:
Create a new tag following semantic versioning then use the publish feature in github.
git tag v1.0.0
git push origin v1.0.0- Specific versions:
v1.0.0,v1.1.0,v2.0.0 - Major version tags:
v1,v2(automatically updated)
Users can reference either:
greedigoblins/trigger-workflow-and-wait@v1(always latest v1.x.x)greedigoblins/trigger-workflow-and-wait@v1.0.0(specific version)
owner: Required. The owner of the repository where the workflow is located.repo: Required. The name of the repository where the workflow is located.github_token: Required. A GitHub token with permissions to trigger workflows.workflow_file_name: Required. The name of the workflow file to trigger.wait_workflow: Optional. Set totrueto wait for the triggered workflow to finish. Default istrue.propagate_failure: Optional. Set totrueto propagate the failure of the triggered workflow to the calling workflow. Default istrue.wait_interval: Optional. The interval in seconds to wait between checks for the workflow status. Default is10.client_payload: Optional. A JSON string containing inputs to pass to the triggered workflow.ref: Optional. The git reference for the workflow run (branch, tag, or commit SHA). Default ismain.
workflow_id: The ID of the triggered workflow run.workflow_url: The URL of the triggered workflow run.conclusion: The conclusion of the workflow run (success, failure, etc.).status: The status of the workflow run (completed, in_progress, etc.).
Here is an example of how to use this action in a workflow:
name: Example Workflow
on:
push:
branches:
- main
jobs:
trigger-workflow:
runs-on: ubuntu-latest
steps:
- name: Trigger another workflow
uses: ./trigger-workflow-and-wait
with:
owner: your-github-username
repo: your-repo-name
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow_file_name: your-workflow-file.ymlThis action is built using Node.js and uses @vercel/ncc to create a single, minified bundle for optimal performance in GitHub Actions.
To build the action:
npm run buildThis creates a bundled version in the dist/ directory that includes all dependencies.
Run the test suite:
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch- Create a feature branch
- Make changes to the source code in the
src/directory - Run tests to ensure everything works:
npm test - Build the action:
npm run build:complete - Commit both source and built files
- Create a PR to
main - Someone with admin access can publish the package
This project is licensed under the MIT License. See the LICENSE file for details.