Skip to content

Commit 0d203b3

Browse files
committed
Document usage
1 parent 4f5ed58 commit 0d203b3

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

README.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,72 @@
1-
# GitHub Workflow Dispatch Plus
1+
# Workflow Dispatch Plus
2+
3+
Trigger Github Action workflows, and optionally wait for the result.
4+
5+
## Usage
6+
7+
### Basic
8+
9+
**upstream.yml**
10+
11+
```yml
12+
job:
13+
example:
14+
steps:
15+
- use: pauldraper/workflow-dispatch@v1
16+
with:
17+
inputs: '{"color": "blue"}'
18+
owner: example # defaults to current owner
19+
ref: refs/head/main # defaults to current ref
20+
repo: example # defaults to current repo
21+
token: "${{ secrets.GH_TOKEN }}" # personal access token with actions read/write
22+
wait: true # defaults to false
23+
workflow: downstream.yml
24+
```
25+
26+
**downstream.yml**
27+
28+
```yml
29+
on: [workflow_dispatch]
30+
```
31+
32+
### Marker Step
33+
34+
The Github API does not provide a direct association between a workflow dispatch
35+
and the workflow run. Workflow Dispatch Plus infers the relationship.
36+
37+
For greater robustness, it can pass the URL of the upstream run to the
38+
downstream run.
39+
40+
**upstream.yml**
41+
42+
```yml
43+
job:
44+
example:
45+
steps:
46+
- use: pauldraper/workflow-dispatch@v1
47+
with:
48+
marker-input: upstream-url
49+
token: "${{ secrets.GH_TOKEN }}"
50+
```
51+
52+
**downstream.yml**
53+
54+
```yml
55+
jobs:
56+
example:
57+
steps:
58+
- if: "${{ inputs.upstream-url }}"
59+
name: "${{ inputs.upstream-url }}"
60+
run:
61+
echo 'Started by [${{ inputs.upstream-url }}](${{ inputs.upstream-url
62+
}})' >> "$GITHUB_STEP_SUMMARY"
63+
on:
64+
workflow_dispatch:
65+
inputs:
66+
upstream-url:
67+
description: URL of upstream run
68+
```
69+
70+
### Outputs
71+
72+
The step outputs `run_id` and `conclusion`.

0 commit comments

Comments
 (0)