Skip to content

Commit aecb612

Browse files
feat: add new sleep length parameter to action (#22)
Signed-off-by: Andrew Brandt <[email protected]> Co-authored-by: Roger Barker <[email protected]>
1 parent db5c8a7 commit aecb612

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ fine-grained token with the following permissions:
3636
## 📦 Inputs
3737

3838
| Name | Description | Required | Default |
39-
|------------------------|-------------------------------------------------------------------------------------------------------|----------|------------------------|
40-
| `token` | GitHub Personal Access Token (Fine-Grained with: Repository custom properties `Read and Write` scope) | ✅ Yes ||
41-
| `repo-properties.yaml` | File should be located in the root-level directory. | ✅ Yes | `repo-properties.yaml` |
39+
|------------------------|-------------------------------------------------------------------------------------------------------|-------|------------------------|
40+
| `token` | GitHub Personal Access Token (Fine-Grained with: Repository custom properties `Read and Write` scope) |||
41+
| `repo-properties.yaml` | File should be located in the root-level directory. || `repo-properties.yaml` |
42+
| `sleep-length` | Time (seconds) to sleep between API calls | - | `1 second`
4243

4344
---
4445

@@ -54,6 +55,7 @@ jobs:
5455
- uses: PandasWhoCode/update-custom-properties@v1
5556
with:
5657
token: ${{ secrets.GH_CUSTOM_PROPERTIES_TOKEN }}
58+
sleep-length: '5'
5759
```
5860
5961
---

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: '0'
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)