Skip to content

Commit 15faeef

Browse files
committed
feat: add new sleep length parameter to action
**Description**: This PR adds a new flag to allow for sleeping between each API call to avoid rate limiting. **Related Issue(s)**: Implements #21 Signed-off-by: Andrew Brandt <[email protected]>
1 parent db5c8a7 commit 15faeef

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

action.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ inputs:
1010
token:
1111
description: 'Personal Access Token'
1212
required: true
13+
sleep-length:
14+
description: 'Time to sleep (sec) between API calls'
15+
required: false
16+
default: 1
1317

1418
runs:
1519
using: "composite"
@@ -38,6 +42,7 @@ runs:
3842
shell: bash
3943
env:
4044
GH_TOKEN: ${{ inputs.token }}
45+
SLEEP_LENGTH: ${{ inputs.sleep-length }}
4146
run: |
4247
# Input files
4348
REPO_NAMES_FILE="repo-names.txt"
@@ -85,6 +90,7 @@ runs:
8590
fi
8691
# API Call here
8792
gh api --method PATCH -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${ORG_NAME}/${REPO_NAME}/properties/values -f "properties[][property_name]=${key}" -f "properties[][value]=${value}"
93+
sleep "${SLEEP_LENGTH}"
8894
done
8995
done < "${REPO_NAMES_FILE}"
9096
echo "Successfully set custom properties!"

0 commit comments

Comments
 (0)