diff --git a/Readme.md b/Readme.md index 6165709..854c788 100644 --- a/Readme.md +++ b/Readme.md @@ -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 @@ -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. @@ -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: @@ -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: @@ -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: @@ -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' ``` diff --git a/action.yml b/action.yml index 3cbf6b9..a136566 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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 ) }}'