Skip to content

AliSajid/random-wait-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wait for a random amount of time

GitHub release (latest by date) GitHub Build Tests CodeQL semantic-release REUSE status OpenSSF Best Practices OpenSSF Scorecard

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

Simple Specification

name: Random Wait
uses: AliSajid/random-wait-action@v2

Pinned SHA version with explicit parameters

name: Add Random Waiting Time
uses: AliSajid/random-wait-action@f9109712daa7a8103f7be16b68634b9d376587a7 # v2.4.1
with:
    minimum: 1
    maximum: 10

License

This original source code of this project is licensed under the MIT License. Other non-essential files are licensed under the CC0 Public Domain Dedication and the author(s) dedicate them to the public domain.