Skip to content

Commit e886724

Browse files
Make workflow-restarter docs more clear
1 parent f9b91cc commit e886724

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

docs/workflow-restarter.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,24 @@ Nevertheless, it is possible to programmatically restart a workflow after it fai
88

99
## Usage
1010

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
1212

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.
1415

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).
1619

1720
* 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.
1821
* Raise and merge a PR adding the above to the main branch of your repository.
1922
* 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.
2023

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
2229

2330
```yaml
2431
on-failure-workflow-restarter-proxy:
@@ -42,6 +49,8 @@ Once the above `Workflow Restarter TEST` is working then you should be able to a
4249
run_id: ${{ github.run_id }}
4350
```
4451
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+
4554
## Appendix
4655

4756
### Verify `Workflow Restarter` with `Workflow Restarter TEST`

0 commit comments

Comments
 (0)