From 43b5b3d6a97c690ea9f1f40a98fb4ec5af297b61 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 14 May 2025 14:52:50 -0400 Subject: [PATCH] Enhance GitHubClient: add method to update repository topics with GitHub API support and improved headers. --- template_automation/github_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/template_automation/github_client.py b/template_automation/github_client.py index 59c3dc7..dc34d36 100644 --- a/template_automation/github_client.py +++ b/template_automation/github_client.py @@ -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}")