diff --git a/.github/workflows/JsActionPublish.yml b/.github/workflows/JsActionPublish.yml index 345d66c7..ab423bb2 100644 --- a/.github/workflows/JsActionPublish.yml +++ b/.github/workflows/JsActionPublish.yml @@ -19,7 +19,7 @@ jobs : fail-fast : false matrix : os : [ ubuntu-latest, windows-latest, macos-latest ] - node-version : [ 12.9.1, 14.x, 16.x, 18.x ] + node-version : [ 18.x, 20.x ] if : "startsWith( github.event.head_commit.message, 'version' ) && startsWith( github.ref, 'refs/tags/v' )" runs-on : ${{ matrix.os }} steps : @@ -33,29 +33,17 @@ jobs : - name : Setup git for windows if : ${{ matrix.os == 'windows-latest' }} run : git config --system core.longpaths true - - uses : actions/checkout@v2 + - uses : actions/checkout@v4 with : - fetch-depth: 2 + ref: js_action - name : ${{ matrix.node-version }} uses : Wandalen/wretry.action@master with : - action : actions/setup-node@v2 + action : actions/setup-node@v4 with : | node-version : ${{ matrix.node-version }} attempt_limit : 3 attempt_delay: 1000 - - name : Save npm version - id : getnpmver - run : | - echo "npmver=$(npm -v)" >> $GITHUB_OUTPUT - - name : Update npm if current version is 6 - if : "startsWith( steps.getnpmver.outputs.npmver, '6.' )" - run : npm install -g npm@latest-6 - - name : Update node-gyp - if: ${{ matrix.os == 'windows-latest' && matrix.node-version != '18.x' }} - run : | - npm install --global node-gyp@9.0.0 - npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"} - name : Install willbe uses : Wandalen/wretry.action@master with : diff --git a/.github/workflows/JsActionPullRequest.yml b/.github/workflows/JsActionPullRequest.yml index e1fbbd6a..534ae84b 100644 --- a/.github/workflows/JsActionPullRequest.yml +++ b/.github/workflows/JsActionPullRequest.yml @@ -18,7 +18,7 @@ jobs : fail-fast : false matrix : os : [ ubuntu-latest, windows-latest, macos-latest ] - node-version : [ 14.x ] + node-version : [ 20.x ] runs-on : ${{ matrix.os }} steps : - name : Setup git @@ -31,27 +31,15 @@ jobs : - name : Setup git for windows if : ${{ matrix.os == 'windows-latest' }} run : git config --system core.longpaths true - - uses : actions/checkout@v2 - with : - fetch-depth: 2 + - uses : actions/checkout@v4 - name : ${{ matrix.node-version }} uses : Wandalen/wretry.action@master with : - action : actions/setup-node@v2 + action : actions/setup-node@v4 with : | node-version : ${{ matrix.node-version }} attempt_limit : 3 attempt_delay: 1000 - - name : Update npm - if : ${{ matrix.os == 'windows-latest' && matrix.node-version > '14.x' }} - run : | - npm install --global --production npm-windows-upgrade - npm-windows-upgrade --npm-version latest - - name : Update node-gyp - if: ${{ matrix.os == 'windows-latest' && matrix.node-version != '18.x' }} - run : | - npm install --global node-gyp@9.0.0 - npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"} - name : Install willbe uses : Wandalen/wretry.action@master with : diff --git a/.github/workflows/JsActionPush.yml b/.github/workflows/JsActionPush.yml index 9c55c547..b9732f75 100644 --- a/.github/workflows/JsActionPush.yml +++ b/.github/workflows/JsActionPush.yml @@ -17,7 +17,7 @@ jobs : fail-fast : false matrix : os : [ ubuntu-latest, windows-latest, macos-latest ] - node-version : [ 14.x ] + node-version : [ 20.x ] if : | !startsWith( github.event.head_commit.message, 'version' ) && !startsWith( github.event.head_commit.message, '.' ) @@ -34,29 +34,15 @@ jobs : - name : Setup git for windows if : ${{ matrix.os == 'windows-latest' }} run : git config --system core.longpaths true - - uses : actions/checkout@v2 - with : - fetch-depth: 2 + - uses : actions/checkout@v4 - name : ${{ matrix.node-version }} uses : Wandalen/wretry.action@master with : - action : actions/setup-node@v2 + action : actions/setup-node@v4 with : | node-version : ${{ matrix.node-version }} attempt_limit : 3 attempt_delay: 1000 - - name : Save npm version - id : getnpmver - run : | - echo "npmver=$(npm -v)" >> $GITHUB_OUTPUT - - name : Update npm if current version is 6 - if : "startsWith( steps.getnpmver.outputs.npmver, '6.' )" - run : npm install -g npm@latest-6 - - name : Update node-gyp - if: ${{ matrix.os == 'windows-latest' && matrix.node-version != '18.x' }} - run : | - npm install --global node-gyp@9.0.0 - npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"} - name : Install willbe uses : Wandalen/wretry.action@master with : diff --git a/Readme.md b/Readme.md index a2632ba6..71cd731c 100644 --- a/Readme.md +++ b/Readme.md @@ -2,13 +2,13 @@ # action::retry [![status](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml/badge.svg)](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml) [![stable](https://img.shields.io/badge/stability-stable-brightgreen.svg)](https://github.com/emersion/stability-badges#stable) -Retries an Github Action step or command on failure. +Retries a Github Action step or command on failure. Works with either shell commands or other actions to retry. ## Why -Github actions which use an Internet connection can fail when connection is lost : +Github actions which use the Internet connection can fail when connection is lost : ```bash Run actions/setup-node@v1 @@ -23,13 +23,18 @@ It is a cause of failed jobs. For this case, the action `wretry.action` can retr ## Features -- Retries Github `JavaScript` actions. The action can be an action repository that is not published on `Marketplace`. -- Retries shell commands. +- Retries Github `JavaScript` actions. +- Retries `GitHub Docker` actions utilizing a `Dockerfile` as the image source. +- Retries private actions. The option `github_token` is used for private repositories. +- The action can be an action repository that is not published on `Marketplace`. +- Retries shell commands. Uses default shells to run commands. - Can retry single action or single command ( multiline command ), but not both simultaneously. - Retries `main`, `pre` and `post` stages of external actions. -- Always has `pre` and `post` stages. If external action has `pre` or/and `post` stage, then action run it also. -- Handles no conditions in external actions ( fields `pre-if` and `post-if` ). All stages of external action will be performed. -- Resolves external action default inputs from next contexts : `github`, `env`, `job`, `matrix`. +- Default action always includes both `pre` and `post` stages. If an external action contains a `pre` and/or `post` stage, the action will also execute these stages. +- The repository includes subdirectories with alternative action setups that can skip the `pre` or/and `post` stages, as necessary. +- Action handles conditions in `JavaScript` and `Docker` actions ( fields `pre-if` and `post-if` ). Some conditions can be unsolvable and then action skips the stage. +- Resolves external action default inputs from next contexts : `github`, `env`, `job`, `matrix`, `inputs`. +- Can resolve user-provided context `steps`. - Retries actions with defined number of attempts ( default is 2 ). - Retries actions with defined delay between attempts ( default is 0 ). @@ -37,13 +42,15 @@ It is a cause of failed jobs. For this case, the action `wretry.action` can retr ### `action` -The name of the Github action. +The name of a Github action. Format is `{owner}/{repo_name}@{ref}`. + +**Attention**. Action requires defined `action` or `command`. If the fields `action` and `commands` are defined simultaneously, then action will throw error. ### `command` -The command to run. +The command to run. The action runs the command in the default shell. -**Attend**. Action requires defined `action` or `command`. If the fields `action` and `commands` are defined simultaneously, then action will throw error. +**Attention**. Action requires defined `action` or `command`. If the fields `action` and `commands` are defined simultaneously, then action will throw error. ### `with` @@ -51,7 +58,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 @@ -61,7 +67,6 @@ An example of declaration of option with single line value : ``` An example of declaration of option with multiline string : ```yaml - - uses: Wandalen/wretry.action@master with: action: owner/action-repo@version @@ -77,6 +82,10 @@ An example of declaration of option with multiline string : Setup working directory for the action. Works with only commands. Default is `github.workspace` path. +### `steps_context` + +Pass context `steps` into an external action. The action cannot resolve runtime context `steps` from environment contexts. If you need valid context `steps`, then add option `steps_context : ${{ toJSON( steps ) }}`. + ### `attempt_limit` Set number of attempts. Default is 2. @@ -85,21 +94,58 @@ Set number of attempts. Default is 2. Set delay between attempts in ms. Default is 0. +### `time_out` + +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 control the continuation of retries. If the expression resolves to `false`, the action will interrupt the 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 in expression tokens `${{ }}`. The Github workflow runner will resolve the expressions wrapped in these tokens and replace the action input with the specific value. If you don't need the expression to be recalculated for each retry, you can put it inside the expression tokens. + +**How to use outputs of current step in condition** + +The action can resolve the output of the current step using the special syntax: `steps._this.outputs.`. The action uses the special name `_this` to refer to the current step. If you have a step with the name `_this` and provide the steps context using the `steps_context` option, the action will rewrite the value of this field. This does not affect the outputs of the workflow, but allows the action to access the current step's outputs. + +Example of condition with check of current step output: +```yaml +- uses: Wandalen/wretry.action@master + with: + action: owner/action-repo@version + retry_condition: steps._this.outputs.code == 0 + with: | + option1: value + option2: value +``` + +### `github_token` + +A token to access private actions. Does not required for public actions. + ## Outputs -The action exposes single output named `outputs`. It collects all the outputs from the action/command in the pretty print JSON map. +The action exposes single output named `outputs`. It collects all the outputs from the action/command in JSON map. ### How to use outputs from the external action 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: runs-on: ubuntu-latest outputs: + # extract `outputs` from a step out: ${{ steps.my-action.outputs.outputs }} steps: - id: my-action @@ -114,17 +160,44 @@ jobs: needs: job1 steps: - env: + # parse full map and store it to OUPUT1 OUTPUT1: ${{ fromJSON( needs.job1.outputs.out ) }} + # parse full map and extract field `foo` OUTPUT2: ${{ fromJSON( needs.job1.outputs.out ).foo }} run: echo "$OUTPUT1 $OUTPUT2" ``` To setup job output we access output `outputs` of the step `my-action`. In the job `job2` we parse this output to JSON. The environment variable `OUPUT1` represents full JSON and the variable `OUPUT2` represents key `foo` of the parsed JSON. +## How to skip `pre` or/and `post` stages + +The repository provides three subdirectories, each containing a different setup for action retries: + +- `pre`: This directory retries the `pre` and `main` stages. +- `post`: This directory retries the `main` and `post` stages. +- `main`: This directory retries only the `main` stage. + +It is crucial to note that, regardless of the retried action specification, the actions in the repository will only execute the declared stages. This behavior can disrupt your workflow, so please use the actions with caution. + +### Selecting the Alternative Action + +You have a few options for obtaining a compatible action implementation: +- Run the workflow with the required action, but without the `wretry.action`, and check the stages in the workflow run. +- Open the action directory and review the `action.yml` file. Look for any extra stages listed besides `main`. +- If you run command, then you can get `main` action that skips `pre` and `post` stages. + +### Declaration of alternative action + +To choose an alternative action add the action subdirectory in declaration of `wretry.action`. For example, the declaration with `main` subdirectory: +```yml +- uses: Wandalen/wretry.action/main@master +``` + +You can choose either method based on your preference. If you prefer not to perform additional manipulations, you can select the default `wretry.action` that retries all available stages of the external action. + ## Example usage ### Retry action - ```yaml - uses: Wandalen/wretry.action@master with: @@ -137,7 +210,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: @@ -149,7 +221,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 921d45a1..ab79cc84 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,12 @@ inputs: Setup working directory for the action. Works with only commands. Default is `github.workspace` path. required: false + steps_context: + description: >- + Pass context `steps` into an external action. If you need valid context + `steps`, then add option as described in `Readme.md`. + required: false + default: '{}' attempt_limit: description: Number of attempts required: false @@ -29,6 +35,21 @@ inputs: description: A delay between attempts in ms required: false default: 0 + time_out: + description: >- + Set time out in ms for entire step including all retries. By default + 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 outputs: outputs: description: A pretty print JSON map with outputs from the wrapped action. @@ -38,15 +59,19 @@ runs: steps: - name: retry id: retry - uses: Wandalen/wretry.action@v1.2.0_js_action + uses: Wandalen/wretry.action@v3.5.0_js_action with: action: '${{ inputs.action }}' command: '${{ inputs.command }}' with: '${{ inputs.with }}' current_path: '${{ inputs.current_path }}' + steps_context: '${{ inputs.steps_context }}' 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 ) }}' matrix_context: '${{ toJSON( matrix ) }}' + time_out: '${{ inputs.time_out }}' + github_token: '${{ inputs.github_token }}' diff --git a/doc/readme.md b/doc/readme.md new file mode 100644 index 00000000..9ad1b013 --- /dev/null +++ b/doc/readme.md @@ -0,0 +1,9 @@ +### To publish + +```will .publish action.release.minor``` + +### List of actions + +- [useful-actions](https://github.com/GuillaumeFalourd/useful-actions) ( _accepted_ ) +- [awesome-actions, PR](https://github.com/sdras/awesome-actions/pull/579) ( _opened_ ) + diff --git a/main/Readme.md b/main/Readme.md new file mode 100644 index 00000000..e2f77ba0 --- /dev/null +++ b/main/Readme.md @@ -0,0 +1,5 @@ +[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua) + +# action::retry [![status](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml/badge.svg)](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml) [![stable](https://img.shields.io/badge/stability-stable-brightgreen.svg)](https://github.com/emersion/stability-badges#stable) + +An alternative [action](../Readme.md) declaration that skips `pre` and `post` stages. It is useful for retrying actions with only `main` stage. diff --git a/main/action.yml b/main/action.yml new file mode 100644 index 00000000..19481b53 --- /dev/null +++ b/main/action.yml @@ -0,0 +1,77 @@ +name: retry action +author: | + Wandalen + dmvict +branding: + icon: activity + color: white +description: Retries an Github Action step on failure +inputs: + action: + description: 'Github action name. Should be defined action or command, not both.' + required: false + command: + description: 'Command to run. Should be defined action or command, not both.' + required: false + with: + description: An options map for Github action + required: false + current_path: + description: >- + Setup working directory for the action. Works with only commands. Default + is `github.workspace` path. + required: false + steps_context: + description: >- + Pass context `steps` into an external action. If you need valid context + `steps`, then add option as described in `Readme.md`. + required: false + default: '{}' + attempt_limit: + description: Number of attempts + required: false + default: 2 + attempt_delay: + description: A delay between attempts in ms + required: false + default: 0 + time_out: + description: >- + Set time out in ms for entire step including all retries. By default + 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 +outputs: + outputs: + description: A pretty print JSON map with outputs from the wrapped action. + value: '${{ toJSON( steps.retry.outputs ) }}' +runs: + using: composite + steps: + - name: retry + id: retry + uses: Wandalen/wretry.action/main@v3.5.0_js_action + with: + action: '${{ inputs.action }}' + command: '${{ inputs.command }}' + with: '${{ inputs.with }}' + current_path: '${{ inputs.current_path }}' + steps_context: '${{ inputs.steps_context }}' + 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 ) }}' + matrix_context: '${{ toJSON( matrix ) }}' + time_out: '${{ inputs.time_out }}' + github_token: '${{ inputs.github_token }}' diff --git a/post/Readme.md b/post/Readme.md new file mode 100644 index 00000000..11205884 --- /dev/null +++ b/post/Readme.md @@ -0,0 +1,5 @@ +[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua) + +# action::retry [![status](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml/badge.svg)](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml) [![stable](https://img.shields.io/badge/stability-stable-brightgreen.svg)](https://github.com/emersion/stability-badges#stable) + +An alternative [action](../Readme.md) declaration that skips `pre` stage. It is useful for retrying actions with `post` stage. diff --git a/post/action.yml b/post/action.yml new file mode 100644 index 00000000..f158adcc --- /dev/null +++ b/post/action.yml @@ -0,0 +1,77 @@ +name: retry action +author: | + Wandalen + dmvict +branding: + icon: activity + color: white +description: Retries an Github Action step on failure +inputs: + action: + description: 'Github action name. Should be defined action or command, not both.' + required: false + command: + description: 'Command to run. Should be defined action or command, not both.' + required: false + with: + description: An options map for Github action + required: false + current_path: + description: >- + Setup working directory for the action. Works with only commands. Default + is `github.workspace` path. + required: false + steps_context: + description: >- + Pass context `steps` into an external action. If you need valid context + `steps`, then add option as described in `Readme.md`. + required: false + default: '{}' + attempt_limit: + description: Number of attempts + required: false + default: 2 + attempt_delay: + description: A delay between attempts in ms + required: false + default: 0 + time_out: + description: >- + Set time out in ms for entire step including all retries. By default + 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 +outputs: + outputs: + description: A pretty print JSON map with outputs from the wrapped action. + value: '${{ toJSON( steps.retry.outputs ) }}' +runs: + using: composite + steps: + - name: retry + id: retry + uses: Wandalen/wretry.action/post@v3.5.0_js_action + with: + action: '${{ inputs.action }}' + command: '${{ inputs.command }}' + with: '${{ inputs.with }}' + current_path: '${{ inputs.current_path }}' + steps_context: '${{ inputs.steps_context }}' + 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 ) }}' + matrix_context: '${{ toJSON( matrix ) }}' + time_out: '${{ inputs.time_out }}' + github_token: '${{ inputs.github_token }}' diff --git a/pre/Readme.md b/pre/Readme.md new file mode 100644 index 00000000..f2bf0129 --- /dev/null +++ b/pre/Readme.md @@ -0,0 +1,5 @@ +[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua) + +# action::retry [![status](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml/badge.svg)](https://github.com/Wandalen/wretry.action/actions/workflows/wRetryActionPublish.yml) [![stable](https://img.shields.io/badge/stability-stable-brightgreen.svg)](https://github.com/emersion/stability-badges#stable) + +An alternative [action](../Readme.md) declaration that skips `post` stage. It is useful for retrying actions with `pre` stage. diff --git a/pre/action.yml b/pre/action.yml new file mode 100644 index 00000000..911bd117 --- /dev/null +++ b/pre/action.yml @@ -0,0 +1,77 @@ +name: retry action +author: | + Wandalen + dmvict +branding: + icon: activity + color: white +description: Retries an Github Action step on failure +inputs: + action: + description: 'Github action name. Should be defined action or command, not both.' + required: false + command: + description: 'Command to run. Should be defined action or command, not both.' + required: false + with: + description: An options map for Github action + required: false + current_path: + description: >- + Setup working directory for the action. Works with only commands. Default + is `github.workspace` path. + required: false + steps_context: + description: >- + Pass context `steps` into an external action. If you need valid context + `steps`, then add option as described in `Readme.md`. + required: false + default: '{}' + attempt_limit: + description: Number of attempts + required: false + default: 2 + attempt_delay: + description: A delay between attempts in ms + required: false + default: 0 + time_out: + description: >- + Set time out in ms for entire step including all retries. By default + 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 +outputs: + outputs: + description: A pretty print JSON map with outputs from the wrapped action. + value: '${{ toJSON( steps.retry.outputs ) }}' +runs: + using: composite + steps: + - name: retry + id: retry + uses: Wandalen/wretry.action/pre@v3.5.0_js_action + with: + action: '${{ inputs.action }}' + command: '${{ inputs.command }}' + with: '${{ inputs.with }}' + current_path: '${{ inputs.current_path }}' + steps_context: '${{ inputs.steps_context }}' + 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 ) }}' + matrix_context: '${{ toJSON( matrix ) }}' + time_out: '${{ inputs.time_out }}' + github_token: '${{ inputs.github_token }}' diff --git a/step/ActionWrite.s b/step/ActionWrite.s index 224337e3..dc3114ac 100644 --- a/step/ActionWrite.s +++ b/step/ActionWrite.s @@ -22,13 +22,19 @@ function actionWrite( frame ) /* */ - const actionPath = fileProvider.path.join( module.dirPath, 'action.yml' ); - const action = fileProvider.fileReadUnknown( actionPath ); - action.runs.steps[ 0 ].uses = `Wandalen/wretry.action@v${ module.about.version }_js_action`; - - logger.log( `Updating action. Setup used action version to "Wandalen/wretry.action@v${ module.about.version }_js_action".` ); - - fileProvider.fileWrite({ filePath : actionPath, data : action, encoding : 'yaml' }); + const subdirectories = [ '', 'main', 'pre', 'post' ]; + for( let i = 0 ; i < subdirectories.length ; i++ ) + { + const slash = subdirectories[ i ] === '' ? '' : '/'; + const actionRelativePath = `${ subdirectories[ i ] }${ slash }action.yml`; + const actionPath = fileProvider.path.join( module.dirPath, actionRelativePath ); + const action = fileProvider.fileReadUnknown( actionPath ); + action.runs.steps[ 0 ].uses = `Wandalen/wretry.action${ slash }${ subdirectories[ i ] }@v${ module.about.version }_js_action`; + + logger.log( `Updating action file "${ actionRelativePath }". Setup action version to "${ action.runs.steps[ 0 ].uses }".` ); + + fileProvider.fileWrite({ filePath : actionPath, data : action, encoding : 'yaml' }); + } } module.exports = actionWrite; diff --git a/will.yml b/will.yml index ae3f427b..3d11eb45 100644 --- a/will.yml +++ b/will.yml @@ -1,6 +1,6 @@ about: name: wretry.action - version: 1.2.0 + version: 3.5.0 description: Retries an Github Action step on failure enabled: 0 author: Kostiantyn Wandalen @@ -93,7 +93,7 @@ submodule: path: 'npm:///@actions/core!1.10.0' enabled: 0 github-actions-parser: - path: 'npm:///github-actions-parser!0.26.0' + path: 'npm:///github-actions-parser!dmvict/github-actions-parser' enabled: 0 wgittools: path: 'npm:///wgittools!alpha' @@ -174,19 +174,23 @@ reflector: maskAll: excludeAny: - ! /@actions/ + - ! /@fastify/ - ! /argparse/ - ! /bindings/ - ! /chevrotain/ - ! /file-uri-to-path/ - ! /github-actions-parser/ - ! /graceful-fs/ + - ! /ini/ - ! /js-yaml/ + - ! /lodash/ - ! /proper-lockfile/ - ! /regexp-to-ast/ - ! /retry/ - ! /signal-exit/ - ! /tunnel/ - ! /uuid/ + - ! /undici/ - ! /yaml-ast-parser/ - ! /Joined.s/ step: