GHA execution throttling #3739

This commit is contained in:
rusefillc 2022-01-13 13:27:01 -05:00
parent 7c5c82f14b
commit 5c8ce56e87
1 changed files with 0 additions and 23 deletions

View File

@ -1,23 +0,0 @@
#!/bin/bash
#
# we use this script to reduce github actions load by executing some tasks less frequent than always
# param: THRESHOLD, rate of SKIPPING task, from 0 to 100. No skipping if zero, always skipping if 100.
#
THRESHOLD=$1
if [ -z $THRESHOLD ] ; then
echo "Throttle threshold not specified, allowing always"
exit 0
fi
RANDOM100=$(($RANDOM % 100))
msg="Random ${RANDOM100} while threshold $THRESHOLD:"
if (( ${RANDOM100} > $THRESHOLD )); then
echo "$msg Allowing"
exit 0
else
echo "$msg Not this time, maybe next time"
exit -1
fi