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
+13-4Lines changed: 13 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -8,17 +8,24 @@ Nevertheless, it is possible to programmatically restart a workflow after it fai
8
8
9
9
## Usage
10
10
11
-
If setting up the the `workflow-restarter` for the first time, then make sure to initialize it first and then configure another workflow to programmatically restart on failure.
11
+
If setting up the the `workflow-restarter` for the first time, then make sure to initialize it first and then configure another workflow to programmatically restart on failure. In other words, you need to create 2 PRs
12
12
13
-
### Initialize the `Workflow Restarter`
13
+
* Create one PR that only adds the `.github/workflows/{workflow-restarter.yml,workflow-restarter-test.yml}` files. See [Create the first PR...](#create-the-first-pr-to-initialize-the-workflow-restarter) section below.
14
+
* Create a second PR to add the `on-failure-workflow-restarter-proxy` to existing workflows. See [Create the second PR...](#create-the-second-pr-to-re-use-it-in-other-workflows) section below.
14
15
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
+
### Create the first PR to initialize the `Workflow Restarter`
17
+
18
+
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, for the `workflow-restarter` to work, it must be merged into the `main` branch before it can be referenced by other workflows (this seems to be a github action feature).
16
19
17
20
* 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
21
* Raise and merge a PR adding the above to the main branch of your repository.
19
22
* 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.
20
23
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
24
+
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, which is described in the next section.
25
+
26
+
### Create the second PR to re-use it in other workflows
27
+
28
+
The key here 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
22
29
23
30
```yaml
24
31
on-failure-workflow-restarter-proxy:
@@ -42,6 +49,8 @@ Once the above `Workflow Restarter TEST` is working then you should be able to a
42
49
run_id: ${{ github.run_id }}
43
50
```
44
51
52
+
As well as adding updates to your existing workflows, you may also want to remove the `.github/workflows/workflow-restarter-test.yml` at this stage to keep your repository workflows tidy.
53
+
45
54
## Appendix
46
55
47
56
### Verify `Workflow Restarter` with `Workflow Restarter TEST`
0 commit comments