Skip to content

Commit

Permalink
Synchronize action with branch js_action, add option retry_condition
Browse files Browse the repository at this point in the history
  • Loading branch information
dmvict committed Apr 4, 2024
1 parent 1b2dcdb commit 7ea6dfd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ An options map for Github action. It is a multiline string with pairs `key : val

An example of declaration of option with single line value :
```yaml

- uses: Wandalen/wretry.action@master
with:
action: owner/action-repo@version
Expand Down Expand Up @@ -94,6 +93,20 @@ Set delay between attempts in ms. Default is 0.

Set time out in ms for entire step including all retries. By default actions sets no time out.

### `retry_condition`

Use any valid expression to decide the continuation of retries. If expression resolves to `false`, then the action interrupts retries. Default value is `true`.
```yaml
- uses: Wandalen/wretry.action@master
with:
action: owner/action-repo@version
retry_condition: github.ref_name == 'main'
with: |
option1: value
option2: value
```
It is important to skip expression tokens `${{ }}` because Github workflow runner resolves expressions wrapped in the tokens to a specific value and replaces action input.

### `github_token`

A token to access private actions. Does not required for public actions.
Expand All @@ -107,7 +120,6 @@ The action exposes single output named `outputs`. It collects all the outputs fr
To access the value from an external action outputs parse the `wretry.action` output and select required key. To parse the outputs use builtin Github Actions function `fromJSON`.

Let's look at an example:

```yaml
jobs:
job1:
Expand Down Expand Up @@ -140,7 +152,6 @@ To setup job output we access output `outputs` of the step `my-action`. In the j
## Example usage

### Retry action

```yaml
- uses: Wandalen/wretry.action@master
with:
Expand All @@ -153,7 +164,6 @@ To setup job output we access output `outputs` of the step `my-action`. In the j
```

### Retry command

```yaml
- uses: Wandalen/wretry.action@master
with:
Expand All @@ -165,7 +175,6 @@ To setup job output we access output `outputs` of the step `my-action`. In the j
### Development and contributing

To build compiled dependencies utility `willbe` is required. To install utility run :

```
npm i -g 'willbe@latest'
```
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ inputs:
actions sets no time out.
required: false
default: false
retry_condition:
description: 'Use any valid expression to decide the continuation of retries. Default value is true.'
required: false
default: true
github_token:
description: A token to access private actions. Does not required for public actions.
required: false
Expand All @@ -55,6 +59,7 @@ runs:
current_path: '${{ inputs.current_path }}'
attempt_limit: '${{ inputs.attempt_limit }}'
attempt_delay: '${{ inputs.attempt_delay }}'
retry_condition: '${{ inputs.retry_condition }}'
env_context: '${{ toJSON( env ) }}'
github_context: '${{ toJSON( github ) }}'
job_context: '${{ toJSON( job ) }}'
Expand Down

0 comments on commit 7ea6dfd

Please sign in to comment.