You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69-12Lines changed: 69 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,77 +11,94 @@ For details of the `workflow_dispatch` even see [this blog post introducing this
11
11
12
12
*Note 2.* If you want to reference the target workflow by ID, you will need to list them with the following REST API call `curl https://api.github.com/repos/{{owner}}/{{repo}}/actions/workflows -H "Authorization: token {{pat-token}}"`
13
13
14
-
_This action is a fork of `benc-uk/workflow-dispatch` to add support for waiting for workflow completion._
14
+
*This action is a fork of `benc-uk/workflow-dispatch` to add support for waiting for workflow completion.*
15
15
16
16
## Inputs
17
+
17
18
### `workflow`
19
+
18
20
> **Required.** The name or the filename or ID of the workflow to trigger and run.
19
21
20
22
### `token`
21
23
22
24
> **Required.** A GitHub access token (PAT) with write access to the repo in question.
23
-
>
25
+
>
24
26
> **NOTE.** The automatically provided token e.g. `${{ secrets.GITHUB_TOKEN }}` can not be used, GitHub prevents this token from being able to fire the `workflow_dispatch` and `repository_dispatch` event. [The reasons are explained in the docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token).
25
27
> The solution is to manually create a PAT and store it as a secret e.g. `${{ secrets.PERSONAL_TOKEN }}`
26
28
27
29
### `inputs`
30
+
28
31
> **Optional.** The inputs to pass to the workflow (if any are configured), this must be a JSON encoded string, e.g. `{ "myInput": "foobar" }`.
29
32
>
30
33
> All values must be strings (even if they are used as booleans or numbers in the triggered workflow). The triggered workflow should use `fromJson` function to get the right type
31
34
32
35
### `ref`
36
+
33
37
> **Optional.** The Git reference used with the triggered workflow run. The reference can be a branch, tag, or a commit SHA. If omitted the context ref of the triggering workflow is used. If you want to trigger on pull requests and run the target workflow in the context of the pull request branch, set the ref to `${{ github.event.pull_request.head.ref }}`
34
38
35
39
### `repo`
40
+
36
41
> **Optional.** The default behavior is to trigger workflows in the same repo as the triggering workflow, if you wish to trigger in another GitHub repo "externally", then provide the owner + repo name with slash between them e.g. `microsoft/vscode`
37
42
38
43
### `run-name` (since 3.0.0)
44
+
39
45
> **Optional.** The default behavior is to get the remote run ID based on the latest workflow name and date, if you have multiple of the same workflow running at the same time it can point to an incorrect run id.
40
-
> You can specify the run name to fetch the run ID based on the actual runname.
46
+
> To prevent from this, you can specify a unique run name to fetch the concerned run ID. It will also requires you to set that same value as an input for your remote workflow (See the [corresponding example](#invoke-workflow-with-a-unique-run-name-since-300))
41
47
42
48
### `wait-for-completion`
49
+
43
50
> **Optional.** If `true`, this action will actively poll the workflow run to get the result of the triggered workflow. It is enabled by default. If the triggered workflow fails due to either `failure`, `timed_out` or `cancelled` then the step that has triggered the other workflow will be marked as failed too.
44
51
45
52
### `wait-for-completion-timeout`
53
+
46
54
> **Optional.** The time to wait to mark triggered workflow has timed out. The time must be suffixed by the time unit e.g. `10m`. Time unit can be `s` for seconds, `m` for minutes and `h` for hours. It has no effect if `wait-for-completion` is `false`. Default is `1h`
47
55
48
56
### `wait-for-completion-interval`
57
+
49
58
> **Optional.** The time to wait between two polls for getting run status. The time must be suffixed by the time unit e.g. `10m`. Time unit can be `s` for seconds, `m` for minutes and `h` for hours. It has no effect if `wait-for-completion` is `false`. Default is `1m`.
50
-
>
59
+
>
51
60
> **/!\ Do not use a value that is too small to avoid `API Rate limit exceeded`**
52
61
53
62
### `display-workflow-run-url`
63
+
54
64
> **Optional.** If `true`, it displays in logs the URL of the triggered workflow. It is useful to follow the progress of the triggered workflow. It is enabled by default.
55
65
56
66
### `display-workflow-run-url-timeout`
67
+
57
68
> **Optional.** The time to wait for getting the workflow run URL. If the timeout is reached, it doesn't fail and continues. Displaying the workflow URL is just for information purpose. The time must be suffixed by the time unit e.g. `10m`. Time unit can be `s` for seconds, `m` for minutes and `h` for hours. It has no effect if `display-workflow-run-url` is `false`. Default is `10m`
58
69
59
70
### `display-workflow-run-url-interval`
71
+
60
72
> **Optional.** The time to wait between two polls for getting workflow run URL. The time must be suffixed by the time unit e.g. `10m`. Time unit can be `s` for seconds, `m` for minutes and `h` for hours. It has no effect if `display-workflow-run-url` is `false`. Default is `1m`.
61
-
>
73
+
>
62
74
> **/!\ Do not use a value that is too small to avoid `API Rate limit exceeded`**
63
75
64
76
### `workflow-logs`
77
+
65
78
> **Optional.** Indicate what to do with logs of the triggered workflow:
66
-
>
79
+
>
67
80
> *`print`: Retrieve the logs for each job of the triggered workflow and print into the logs of the job that triggered the workflow.
68
81
> *`ignore`: Do not retrieve log of triggered workflow at all (default).
69
-
>
70
-
> Only available when `wait-for-completion` is `true`.
71
-
>
82
+
>
83
+
> Only available when `wait-for-completion` is `true`.
84
+
>
72
85
> Default is `ignore`.
73
86
74
-
75
87
## Outputs
88
+
76
89
### `workflow-url`
90
+
77
91
> The URL of the workflow run that has been triggered. It may be undefined if the URL couldn't be retrieved (timeout reached) or if `wait-for-completion` and `display-workflow-run-url` are > both `false`
78
92
79
93
### `workflow-conclusion`
94
+
80
95
> The result of the triggered workflow. May be one of `success`, `failure`, `cancelled`, `timed_out`, `skipped`, `neutral`, `action_required`. The step in your workflow will fail if the triggered workflow completes with `failure`, `cancelled` or `timed_out`. Other workflow conlusion are considered success.
81
96
> Only available if `wait-for-completion` is `true`
82
97
83
-
84
98
## Example usage
99
+
100
+
### Invoke workflow without inputs. Wait for result
101
+
85
102
```yaml
86
103
- name: Invoke workflow without inputs. Wait for result
87
104
uses: aurelien-baudet/workflow-dispatch@v2
@@ -90,6 +107,8 @@ _This action is a fork of `benc-uk/workflow-dispatch` to add support for waiting
90
107
token: ${{ secrets.PERSONAL_TOKEN }}
91
108
```
92
109
110
+
### Invoke workflow without inputs. Don't wait for result
111
+
93
112
```yaml
94
113
- name: Invoke workflow without inputs. Don't wait for result
95
114
uses: aurelien-baudet/workflow-dispatch@v2
@@ -99,6 +118,8 @@ _This action is a fork of `benc-uk/workflow-dispatch` to add support for waiting
99
118
wait-for-completion: false
100
119
```
101
120
121
+
### Invoke workflow with inputs
122
+
102
123
```yaml
103
124
- name: Invoke workflow with inputs
104
125
uses: aurelien-baudet/workflow-dispatch@v2
@@ -108,6 +129,8 @@ _This action is a fork of `benc-uk/workflow-dispatch` to add support for waiting
:warning: In you remote workflow, you will need to forward and use the `run-name` input (See [GitHub Action run-name](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#run-name))
177
+
178
+
```yaml
179
+
name: Another Workflow
180
+
run-name: ${{ inputs.run-name }}
181
+
182
+
on:
183
+
workflow_dispatch:
184
+
inputs:
185
+
run-name:
186
+
description: 'The distinct run name used to retrieve the run ID. Defaults to the workflow name'
0 commit comments