-
Notifications
You must be signed in to change notification settings - Fork 1
chore: remove bump-version.py and bump-version.yml #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the bump-version.py script to use new import variables and a dynamic repository URL instead of hardcoded values.
- Replaces hardcoded GitHub API URL with a dynamic URL using
binary_repo
variable - Updates imports to use
binary_tag
instead ofrelease_tag
and addsbinary_repo
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.github/workflows/bump-version.py
Outdated
response = requests.get( | ||
"https://api.github.com/repos/cpp-linter/clang-tools-static-binaries/releases/latest" | ||
) | ||
response = requests.get(f"{binary_repo}/releases/latest") |
Copilot
AI
Aug 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requests
module is used but not imported. Add import requests
at the top of the file.
Copilot uses AI. Check for mistakes.
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRemoved the automated bump-version workflow and its helper script that fetched the latest GitHub release tag and updated Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
💤 Files with no reviewable changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/bump-version.py
(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
.github/workflows/bump-version.py (1)
clang_tools/install.py (1)
clang_tools_binary_url
(66-80)
🪛 Ruff (0.12.2)
.github/workflows/bump-version.py
5-5: Unused blanket noqa
directive
Remove unused noqa
directive
(RUF100)
9-9: Probable use of requests
call without timeout
(S113)
🪛 GitHub Actions: Bump clang-tools binaries version
.github/workflows/bump-version.py
[error] 10-10: JSONDecodeError: Expecting value: line 8 column 1 (char 7) while parsing API response in get_latest_tag() (response.json() call).
[error] 25-25: Command failed: 'bump_tag=python3 bump-version.py
' exited with code 1 due to the above error.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
.github/workflows/bump-version.py (2)
26-26
: binary_tag is the single canonical tag—norelease_tag
references exist, so no alias or downstream updates are needed.
5-5
: Remove# noqa E402
from the importVerified that
binary_repo
andbinary_tag
are defined inclang_tools/__init__.py
and there are no lingeringrelease_tag
imports or assignments.-from clang_tools import binary_repo, binary_tag # noqa E402 +from clang_tools import binary_repo, binary_tag
.github/workflows/bump-version.py
Outdated
response = requests.get(f"{binary_repo}/releases/latest") | ||
return response.json()["tag_name"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix JSONDecodeError: use GitHub API URL, add timeout/auth, and robust error handling.
https://github.com/.../releases/latest
returns HTML; parsing as JSON fails in CI. Normalize binary_repo
to the GitHub API endpoint, add a timeout, pass GITHUB_TOKEN
when available, and validate the response.
Apply this diff:
-def get_latest_tag() -> str:
- response = requests.get(f"{binary_repo}/releases/latest")
- return response.json()["tag_name"]
+def get_latest_tag() -> str:
+ # Normalize to GitHub API URL
+ from urllib.parse import urlparse
+ import os
+ repo = binary_repo.rstrip("/")
+ parsed = urlparse(repo)
+ if "api.github.com" in parsed.netloc:
+ api_url = f"{repo}/releases/latest"
+ elif "github.com" in parsed.netloc:
+ parts = [p for p in parsed.path.split("/") if p]
+ if len(parts) < 2:
+ raise ValueError(f"Invalid binary_repo: {binary_repo}")
+ owner, name = parts[0], parts[1]
+ api_url = f"https://api.github.com/repos/{owner}/{name}/releases/latest"
+ else:
+ raise ValueError(f"Unsupported host in binary_repo: {binary_repo}")
+ headers = {"Accept": "application/vnd.github+json"}
+ token = os.getenv("GITHUB_TOKEN") or os.getenv("GH_TOKEN")
+ if token:
+ headers["Authorization"] = f"Bearer {token}"
+ resp = requests.get(api_url, headers=headers, timeout=15)
+ resp.raise_for_status()
+ data = resp.json()
+ tag = data.get("tag_name")
+ if not tag:
+ raise RuntimeError(f"Missing tag_name in response: {data}")
+ return tag
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
response = requests.get(f"{binary_repo}/releases/latest") | |
return response.json()["tag_name"] | |
def get_latest_tag() -> str: | |
# Normalize to GitHub API URL | |
from urllib.parse import urlparse | |
import os | |
repo = binary_repo.rstrip("/") | |
parsed = urlparse(repo) | |
if "api.github.com" in parsed.netloc: | |
api_url = f"{repo}/releases/latest" | |
elif "github.com" in parsed.netloc: | |
parts = [p for p in parsed.path.split("/") if p] | |
if len(parts) < 2: | |
raise ValueError(f"Invalid binary_repo: {binary_repo}") | |
owner, name = parts[0], parts[1] | |
api_url = f"https://api.github.com/repos/{owner}/{name}/releases/latest" | |
else: | |
raise ValueError(f"Unsupported host in binary_repo: {binary_repo}") | |
headers = {"Accept": "application/vnd.github+json"} | |
token = os.getenv("GITHUB_TOKEN") or os.getenv("GH_TOKEN") | |
if token: | |
headers["Authorization"] = f"Bearer {token}" | |
resp = requests.get(api_url, headers=headers, timeout=15) | |
resp.raise_for_status() | |
data = resp.json() | |
tag = data.get("tag_name") | |
if not tag: | |
raise RuntimeError(f"Missing tag_name in response: {data}") | |
return tag |
🧰 Tools
🪛 Ruff (0.12.2)
9-9: Probable use of requests
call without timeout
(S113)
🪛 GitHub Actions: Bump clang-tools binaries version
[error] 10-10: JSONDecodeError: Expecting value: line 8 column 1 (char 7) while parsing API response in get_latest_tag() (response.json() call).
🤖 Prompt for AI Agents
In .github/workflows/bump-version.py around lines 9-10, change the call that
GETs "{binary_repo}/releases/latest" (which returns HTML) to call the GitHub API
releases endpoint instead, add a timeout, include an Authorization header when
GITHUB_TOKEN is set, and robustly validate the response and JSON. Specifically,
normalize binary_repo into an API URL like
"https://api.github.com/repos/{owner}/{repo}/releases/latest", call requests.get
with headers {"Accept":"application/vnd.github.v3+json", "Authorization":
f"token {GITHUB_TOKEN}"} only if the token exists, and a reasonable timeout
(e.g., 10s); check response.status_code == 200, attempt response.json() inside
try/except to catch JSONDecodeError and requests.RequestException, verify the
JSON contains "tag_name" before returning it, and raise or log a clear error if
any step fails.
|
Summary by CodeRabbit