Skip to content

Commit

Permalink
Enhance GitHubClient: add method to update repository topics with Git…
Browse files Browse the repository at this point in the history
…Hub API support and improved headers.
  • Loading branch information
Your Name committed May 14, 2025
1 parent 9b90297 commit 43b5b3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions template_automation/github_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,12 @@ def update_repository_topics(self, repo_name: str, topics: List[str]) -> None:
Args:
repo_name: Name of the repository
topics: List of topics to set
"""
# GitHub API requires a special media type for repository topics
headers = {"Accept": "application/vnd.github.mercy-preview+json"}
url = f"/api/v3/repos/{self.org_name}/{repo_name}/topics"

self._request("PUT", url, json={"names": topics}, headers=headers)

logger.info(f"Updated topics for {repo_name}: {topics}")
Expand Down

0 comments on commit 43b5b3d

Please sign in to comment.