Skip to content

Commit 0a41a72

Browse files
committed
chore: add GitHub PAT support for API requests in CI setup
1 parent f5ee5b8 commit 0a41a72

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/python.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ jobs:
3636
submodules: true
3737
- name: Build wheels
3838
uses: PyO3/maturin-action@v1
39+
env:
40+
READ_ONLY_GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
3941
with:
4042
target: ${{ matrix.platform.target }}
4143
args: --release --out dist --interpreter python3.11 python3.12 python3.13 python3.14 python3.13t python3.14t --auditwheel skip
4244
working-directory: crackers_python
4345
manylinux: manylinux2_28
46+
docker-options: "--env READ_ONLY_GITHUB_TOKEN"
4447
before-script-linux: |
4548
curl -LsSf https://astral.sh/uv/install.sh | sh
4649
uv venv

crackers_python/gh_actions_setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ def install_z3_glibc(target_platform):
6363

6464
# GitHub API to fetch the latest release
6565
api_url = "https://api.github.com/repos/Z3Prover/z3/releases/latest"
66-
with urllib.request.urlopen(api_url) as response:
66+
67+
# Check for GitHub PAT to avoid rate limiting
68+
request = urllib.request.Request(api_url)
69+
github_token = os.environ.get("READ_ONLY_GITHUB_TOKEN")
70+
if github_token:
71+
request.add_header("Authorization", f"Bearer {github_token}")
72+
print("Using GitHub PAT from READ_ONLY_GITHUB_TOKEN for API authentication.", file=sys.stderr)
73+
74+
with urllib.request.urlopen(request) as response:
6775
data = json.loads(response.read().decode())
6876

6977
assets = data.get("assets", [])

0 commit comments

Comments
 (0)