Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

READY: Synchronize action with branch js_action, add option retry_condition #149

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```
**Attention**. The expression can be wrapped by expression tokens `${{ <expr> }}`. Github workflow runner resolves expressions wrapped in the tokens to a specific value and replaces action input. The expression without tokens will be resolved by the action for each retry. If you don't need recalculations put the expression in the expression tokens.

### `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