Skip to content

Commit d641cff

Browse files
committed
fix: auth requests to avoid rate limtis
1 parent f7111dd commit d641cff

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.github/workflows/build-wheel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
rm -rf dist/* build/*
4949
fi
5050
- name: Download native artifacts (from tag c2pa-v0.55.0)
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5153
run: python3 scripts/download_artifacts.py c2pa-v0.55.0
5254
- name: Build wheel
5355
run: python setup.py bdist_wheel

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
rm -rf dist/* build/*
6262
6363
- name: Download native artifacts
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6466
run: python3 scripts/download_artifacts.py c2pa-v0.55.0
6567

6668
- name: Install package in development mode
@@ -107,6 +109,8 @@ jobs:
107109
if (Test-Path build) { Remove-Item -Recurse -Force build }
108110
109111
- name: Download native artifacts
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110114
run: python scripts\download_artifacts.py c2pa-v0.55.0
111115

112116
- name: Install package in development mode

scripts/download_artifacts.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ def get_release_by_tag(tag):
6363
"""Get release information for a specific tag from GitHub."""
6464
url = f"{GITHUB_API_BASE}/repos/{REPO_OWNER}/{REPO_NAME}/releases/tags/{tag}"
6565
print(f"Fetching release information from {url}...")
66-
response = requests.get(url)
66+
headers = {}
67+
if 'GITHUB_TOKEN' in os.environ:
68+
headers['Authorization'] = f"token {os.environ['GITHUB_TOKEN']}"
69+
response = requests.get(url, headers=headers)
6770
response.raise_for_status()
6871
return response.json()
6972

@@ -73,7 +76,10 @@ def download_and_extract_libs(url, platform_name):
7376
platform_dir = SCRIPTS_ARTIFACTS_DIR / platform_name
7477
platform_dir.mkdir(parents=True, exist_ok=True)
7578

76-
response = requests.get(url)
79+
headers = {}
80+
if 'GITHUB_TOKEN' in os.environ:
81+
headers['Authorization'] = f"token {os.environ['GITHUB_TOKEN']}"
82+
response = requests.get(url, headers=headers)
7783
response.raise_for_status()
7884

7985
with zipfile.ZipFile(io.BytesIO(response.content)) as zip_ref:

0 commit comments

Comments
 (0)