Giter VIP home page Giter VIP logo

wretry.action's Introduction

Stand With Ukraine

action::retry status stable

Retries an 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 :

Run actions/setup-node@v1
connect ETIMEDOUT 104.20.22.46:443
Waiting 15 seconds before trying again
connect ETIMEDOUT 104.20.22.46:443
Waiting 18 seconds before trying again
Error: connect ETIMEDOUT 104.20.22.46:443

It is a cause of failed jobs. For this case, the action wretry.action can retry the action immediately after fail or with some delay. And if the connection will be restored, then the job will continue the normal run.

Features

  • Retries Github JavaScript actions. The action can be an action repository that is not published on Marketplace.
  • Retries shell 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.
  • Retries actions with defined number of attempts ( default is 2 ).
  • Retries actions with defined delay between attempts ( default is 0 ).

Inputs

action

The name of the Github action.

command

The command to run.

Attend. Action requires defined action or command. If the fields action and commands are defined simultaneously, then action will throw error.

with

An options map for Github action. It is a multiline string with pairs key : value.

An example of declaration of option with single line value :

- uses: Wandalen/wretry.action@master
  with:
    action: owner/action-repo@version
    with: |
      option1: value
      option2: value

An example of declaration of option with multiline string :

- uses: Wandalen/wretry.action@master
  with:
    action: owner/action-repo@version
    with: |
      option1: |
        value1
        value2
          value3
      option2: value

current_path

Setup working directory for the action. Works with only commands. Default is github.workspace path.

attempt_limit

Set number of attempts. Default is 2.

attempt_delay

Set delay between attempts in ms. Default is 0.

Outputs

Depends on output of given Github action.

Example usage

Retry action

- uses: Wandalen/wretry.action@master
  with:
    action: action/[email protected]
    with: |
      node-version: 14.x
      architecture: x64
    attempt_limit: 3
    attempt_delay: 2000

Retry command

- uses: Wandalen/wretry.action@master
  with:
    command: npm i
    attempt_limit: 3
    attempt_delay: 2000

Development and contributing

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

npm i -g 'willbe@latest'

willbe is not required to use the action in your project as submodule.

wretry.action's People

Contributors

dmvict avatar wandalen avatar karadikidd avatar kosgensys avatar fenollp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.