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: docs/workflow-restarter.md
+10-44Lines changed: 10 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -12,47 +12,13 @@ If setting up the the `workflow-restarter` for the first time, then make sure to
12
12
13
13
### Initialize the `Workflow Restarter`
14
14
15
-
First, configure the `workflow-restarter-proxy` custom action by creating a `workflow-restarter.yml` file beneath the `.github/workflows` directory in your repository.
15
+
In order to begin using the workflow-restarter, you need to first raise a PR and add the workflow restarter to your target repository. In other words,
16
16
17
-
Second, configure the `workflow-restarter` re-usable workflow:
17
+
* Copy [workflow-restarter.yml](./workflow-restarter/workflow-restarter.yml) and [workflow-restarter-test.yml](./workflow-restarter/workflow-restarter-test.yml) to the `.github/workflows` directory of your target directory.
18
+
* Raise and merge a PR adding the above to the main branch of your repository.
19
+
* Verify that the `Workflow Restarter TEST` workflow works as expected. See the [Appendix](#verify-workflow-restarter-with-workflow-restarter-test) for more information on what you should expect to see.
18
20
19
-
```yaml
20
-
name: Workflow Restarter
21
-
on:
22
-
workflow_dispatch:
23
-
inputs:
24
-
repo:
25
-
description: "GitHub repository name."
26
-
required: true
27
-
type: string
28
-
run_id:
29
-
description: "The ID of the workflow run to rerun."
30
-
required: true
31
-
type: string
32
-
retries:
33
-
description: "The number of times to retry the workflow run."
Finally, verify that the `workflow-restarter.yml` performs as expected:
48
-
1. Add a `workflow-restarter-test.yml` file to `.github/workflows`, copy the contents of `./github/workflows/workflow-restarter-test` from this repository
49
-
2. Kick off the `workflow-restarter-test` and it should fail and be re-started 3 times. For example output see the [appendix below](#verify-workflow-restarter-with-workflow-restarter-test).
50
-
51
-
### Configure an existing workflow to use `on-failure-workflow-restarter`
52
-
53
-
Now add something like the following `yaml` job at the end of your workflow, changing only the `needs` section to suit.
54
-
55
-
For example, the following will trigger a restart if either the `acceptance` or the `unit` jobs preceeding it fail. A restart of the failing jobs will be attempted 3 times at which point if the failing jobs continue to fail, then the workflow will be marked as failed. If, however, at any point the `acceptance` and `unit` both pass fine then the restarted workflow will be marked as successful
21
+
Once the above `Workflow Restarter TEST` is working then you should be able to add the workflow restarter to any of your existing github workflows. The key is to re-use the `on-failure-workflow-restarter-proxy` located in the `Workflow Restarter TEST`. For example, the following will trigger a restart if either the `acceptance` or the `unit` jobs preceeding it fail. A restart of the failing jobs will be attempted 3 times at which point if the failing jobs continue to fail, then the workflow will be marked as failed. If, however, at any point the `acceptance` and `unit` both pass fine then the restarted workflow will be marked as successful
56
22
57
23
```yaml
58
24
on-failure-workflow-restarter-proxy:
@@ -82,22 +48,22 @@ For example, the following will trigger a restart if either the `acceptance` or
82
48
83
49
The following shows 3 `Workflow Restarter` occuring after the `Workflow Restarter TEST`, which is set to fail continuously.
84
50
85
-

51
+

86
52
87
53
Looking closer at the `Workflow Restarter TEST` reveals
88
54
89
55
* that the workflow includes 2 jobs `unit` and `acceptance`; and
90
56
* that the workflow has been re-run 3 times, e.g.,
91
57
92
-

58
+

93
59
94
60
Further, the following sequence of screenshots shows that only failed jobs are re-run.
95
61
96
62
* The `on-failure-workflow-restarter` job **(1)** is triggered by the failure of the `unit` job and **(2)** successfully calls the `workflow-restarter` workflow
97
63
* The `workflow-restarter` in turn triggers a re-run of the `unit` job **(3)** and the `Workflow Restarter TEST` shows this as an incremented attempt count at **(4)**.
0 commit comments