Trigger other workflows, display a link, and optionally wait for the result.
See Usage for full documentation.
upstream.yml
job:
example:
steps:
- use: pauldraper/[email protected]
with:
inputs: '{"color": "blue"}'
workflow: downstream.yml
downstream.yml
on:
workflow_dispatch:
inputs:
color:
upstream.yml
job:
example:
steps:
- use: pauldraper/[email protected]
with:
ref: refs/head/main
repo: example/example
token: ${{ secrets.GH_TOKEN }}
wait: "true"
workflow: downstream.yml
downstream.yml
on: [workflow_dispatch]
upstream.yml
job:
example:
steps:
- use: pauldraper/[email protected]
with:
marker-input: upstream-url
workflow: downstream.yml
downstream.yml
jobs:
example:
steps:
- if: ${{ inputs.upstream-url }}
name: ${{ inputs.upstream-url }}
run:
echo 'Started by [${{ inputs.upstream-url }}](${{ inputs.upstream-url
}})' >> "$GITHUB_STEP_SUMMARY"
on:
workflow_dispatch:
inputs:
upstream-url:
description: URL of upstream run
Name | Description | Required | Default |
---|---|---|---|
inputs | JSON object of inputs | No | {} |
marker-input | Name of the downstream's input for upstream URL. | No | `` |
owner | Repsitory owner name | No | ${{ github.repository_owner }} |
ref | Git reference | No | ${{ github.ref }} |
repo | Repository name | No | ${{ github.repository }} |
token | Personal access token | No | ${{ github.token }} |
wait | Whether to wait for conclusion | No | false |
workflow | Workflow path in .github/workflows (e.g. main.yml) | Yes | `` |
Name | Description |
---|---|
conclusion | Workflow conclusion, if wait is true |
run_id | Workflow run ID |
The Github API does not provide a direct association between a workflow dispatch and the subsequent workflow run. For greater robustness in determining the relationship, the upstream URL can be used as an input. The downstream workflow must use that value as the name of a step, so that the action can find it. (See example.)
GITHUB_TOKEN
must have read/write actions permissions. See
Permissions for the GITHUB_TOKEN
.
When starting workflows in other repos, you must create a personal access token
and provide it as the token
input. See
Creating a personal access token
and
Encrypted Secrets.