Skip to content

Commit

Permalink
Add token to try and increase rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanVaughn committed Jan 8, 2023
1 parent cf18f40 commit 56029ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
- name: Get Versions
id: set-matrix
run: echo "matrix=$(python3 versionchecker.py --forced ${{ inputs.forced }})" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

buildversions:
needs: getversions
Expand Down
7 changes: 6 additions & 1 deletion versionchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ def get_latest_versions(

# build url
url = f"https://api.github.com/repos/{repo}/releases"
request = urllib.request.Request(url)

if os.getenv("GITHUB_TOKEN"):
request.add_header("Authorization", f'Bearer {os.environ["GITHUB_TOKEN"]}')

# download data
data = urllib.request.urlopen(url)
data = urllib.request.urlopen(request)
# parse json
json_data = json.loads(data.read().decode())
# only get the latest items
Expand Down

0 comments on commit 56029ae

Please sign in to comment.