Skip to content

Commit 3d762af

Browse files
committed
Add support for custom fanex-ID Bot token
1 parent 405fac5 commit 3d762af

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

bot.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,20 @@ def post_pr_summary(self, pr_number: int) -> None:
331331
def main():
332332
"""Main entry point for the bot."""
333333
# Get environment variables
334-
github_token = os.getenv("GITHUB_TOKEN")
334+
# Prefer FANEX_BOT_TOKEN (GitHub App token) if available, otherwise use GITHUB_TOKEN
335+
github_token = os.getenv("FANEX_BOT_TOKEN") or os.getenv("GITHUB_TOKEN")
335336
repo_name = os.getenv("GITHUB_REPOSITORY")
336337
event_path = os.getenv("GITHUB_EVENT_PATH")
337338

338339
if not github_token or not repo_name:
339-
print("Error: GITHUB_TOKEN and GITHUB_REPOSITORY must be set")
340+
print("Error: FANEX_BOT_TOKEN or GITHUB_TOKEN and GITHUB_REPOSITORY must be set")
340341
sys.exit(1)
342+
343+
# Log which token is being used (for debugging)
344+
if os.getenv("FANEX_BOT_TOKEN"):
345+
print("ℹ️ Using FANEX_BOT_TOKEN - comments will appear as faneX-ID Bot")
346+
else:
347+
print("ℹ️ Using GITHUB_TOKEN - comments will appear as github-actions[bot]")
341348

342349
# Add current directory to path for imports
343350
bot_dir = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)