Skip to content
play

GitHub Action

Random Wait Action

v2.3.2 Latest version

Random Wait Action

play

Random Wait Action

A Github Action to introduce a random delay in a Job

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Random Wait Action

uses: AliSajid/random-wait-action@v2.3.2

Learn more about this action in AliSajid/random-wait-action

Choose a version

Wait for a random amount of time

GitHub release (latest by date) GitHub Build Tests CodeQL semantic-release REUSE status

This is a very simple github action that lets you wait for a random amount of time in seconds. This is useful for workflows that have a lot of parallel jobs and you want to avoid them all hitting the same API at the same time.

I ran into this when I was trying to use the excellent schneegans/dynamic-badges-action to generate a badge for my github action. I wanted to use the action to generate a badge that showed the status of the across a matrix of twelve jobs. However, I kept running into 500 errors from the API. I realized that the API was probably rate limiting me because I was hitting it with twelve requests at the same time. I decided to use this action to add a random delay to each job so that they would hit the API at different times.

Inputs

name type default required
minimum integer 1 no
maximum integer 10 no

Outputs

name type description
wait_time integer The amount of time in seconds that the action waited

Example usage

name: Random Wait
uses: AliSajid/random-wait-action@v1
with:
    minimum: 1
    maximum: 10

License

This project is licensed under the MIT License - see the LICENSE file for details