Skip to content

Conversation

shenxianpeng
Copy link
Collaborator

@shenxianpeng shenxianpeng commented Aug 31, 2025

Summary by CodeRabbit

  • Chores
    • Removed automation that fetched latest release tags and opened dependency bump pull requests.
    • Deleted the associated CI job and helper script.
    • Repository maintenance for this dependency will be handled manually going forward.
    • No changes to product features, user experience, or public APIs.
    • Build and runtime behavior remain unchanged; end users are unaffected.

@shenxianpeng shenxianpeng added the bug Something isn't working label Aug 31, 2025
@shenxianpeng shenxianpeng requested a review from Copilot August 31, 2025 17:55
Copy link
Contributor

@Copilot Copilot AI left a 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 of release_tag and adds binary_repo

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

response = requests.get(
"https://api.github.com/repos/cpp-linter/clang-tools-static-binaries/releases/latest"
)
response = requests.get(f"{binary_repo}/releases/latest")
Copy link

Copilot AI Aug 31, 2025

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.

Copy link

coderabbitai bot commented Aug 31, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Removed the automated bump-version workflow and its helper script that fetched the latest GitHub release tag and updated clang_tools/__init__.py; this eliminates the repository's automated version-bump job and its tag-fetching logic.

Changes

Cohort / File(s) Summary of edits
Removed CI workflow script
.github/workflows/bump-version.py
Deleted file that fetched latest release tag from GitHub and updated clang_tools/__init__.py.
Removed GitHub Actions workflow
.github/workflows/bump-version.yml
Deleted workflow that ran bump-version.py, checked for diffs, and created a pull request to bump clang_tools/__init__.py.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 59cad8b and 31cea82.

📒 Files selected for processing (2)
  • .github/workflows/bump-version.py (0 hunks)
  • .github/workflows/bump-version.yml (0 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/bump-version.yml
  • .github/workflows/bump-version.py
⏰ 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
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-bump-version

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 23df84e and 59cad8b.

📒 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—no release_tag references exist, so no alias or downstream updates are needed.


5-5: Remove # noqa E402 from the import

Verified that binary_repo and binary_tag are defined in clang_tools/__init__.py and there are no lingering release_tag imports or assignments.

-from clang_tools import binary_repo, binary_tag  # noqa E402
+from clang_tools import binary_repo, binary_tag

Comment on lines 9 to 10
response = requests.get(f"{binary_repo}/releases/latest")
return response.json()["tag_name"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

Suggested change
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.

Copy link

@shenxianpeng shenxianpeng changed the title fix: update bump-version.py chore: remove bump-version.py and bump-version.yml Aug 31, 2025
@shenxianpeng shenxianpeng added maintenance Targets chores, refactors and cleanups and removed bug Something isn't working labels Aug 31, 2025
@shenxianpeng shenxianpeng merged commit 13958e2 into main Aug 31, 2025
8 checks passed
@shenxianpeng shenxianpeng deleted the fix-bump-version branch August 31, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Targets chores, refactors and cleanups

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant