ci(deps): add GH_TOKEN to GitHub API requests

This commit is contained in:
Carlo Sala 2026-01-05 11:51:59 +01:00
commit b67a68d836
No known key found for this signature in database
GPG key ID: DA6FB450C1A4FE9A

View file

@ -18,6 +18,12 @@ TMP_DIR = os.path.join(os.environ.get("TMP_DIR", "/tmp"), "ohmyzsh")
DEPS_YAML_FILE = ".github/dependencies.yml" DEPS_YAML_FILE = ".github/dependencies.yml"
# Dry run flag # Dry run flag
DRY_RUN = os.environ.get("DRY_RUN", "0") == "1" DRY_RUN = os.environ.get("DRY_RUN", "0") == "1"
# GitHub Token is needed to avoid rate limiting
GH_TOKEN = os.environ.get("GH_TOKEN", "")
HEADERS = {
"Authorization": f"Bearer {GH_TOKEN}",
"Accept": "application/vnd.github+json",
}
# utils for tag comparison # utils for tag comparison
BASEVERSION = re.compile( BASEVERSION = re.compile(
@ -453,7 +459,7 @@ class GitHub:
url = f"https://api.github.com/repos/{repo}/git/refs/tags" url = f"https://api.github.com/repos/{repo}/git/refs/tags"
# Send a GET request to the GitHub API # Send a GET request to the GitHub API
response = requests.get(url) response = requests.get(url, headers=HEADERS)
current_version = coerce(current_tag) current_version = coerce(current_tag)
if current_version is None: if current_version is None:
raise ValueError( raise ValueError(
@ -513,7 +519,7 @@ class GitHub:
url = f"https://api.github.com/repos/{repo}/compare/{version}...{branch}" url = f"https://api.github.com/repos/{repo}/compare/{version}...{branch}"
# Send a GET request to the GitHub API # Send a GET request to the GitHub API
response = requests.get(url) response = requests.get(url, headers=HEADERS)
# If the request was successful # If the request was successful
if response.status_code == 200: if response.status_code == 200: