From 04667fa89b3d3feb0f28facf9c5ff944a5500e85 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen Date: Thu, 11 Sep 2025 19:49:37 +0300 Subject: [PATCH] fix: eliminate deprecation warnings during GitHub authentication (#145) --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index ef9c920..8a57c64 100755 --- a/main.py +++ b/main.py @@ -3,7 +3,7 @@ import sys import subprocess import re -from github import Github # type: ignore +from github import Github, Auth # type: ignore # Constants for message titles @@ -124,7 +124,10 @@ def add_pr_comments() -> int: raise ValueError("GITHUB_REF environment variable is not set") # Initialize GitHub client - g = Github(token) + # Use new Auth API to avoid deprecation warning + if not token: + raise ValueError("GITHUB_TOKEN is not set") + g = Github(auth=Auth.Token(token)) repo = g.get_repo(repo_name) pull_request = repo.get_issue(int(pr_number))