Skip to content

Commit 04667fa

Browse files
authored
fix: eliminate deprecation warnings during GitHub authentication (#145)
1 parent d627c14 commit 04667fa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import subprocess
55
import re
6-
from github import Github # type: ignore
6+
from github import Github, Auth # type: ignore
77

88

99
# Constants for message titles
@@ -124,7 +124,10 @@ def add_pr_comments() -> int:
124124
raise ValueError("GITHUB_REF environment variable is not set")
125125

126126
# Initialize GitHub client
127-
g = Github(token)
127+
# Use new Auth API to avoid deprecation warning
128+
if not token:
129+
raise ValueError("GITHUB_TOKEN is not set")
130+
g = Github(auth=Auth.Token(token))
128131
repo = g.get_repo(repo_name)
129132
pull_request = repo.get_issue(int(pr_number))
130133

0 commit comments

Comments
 (0)