From b701d7ceec1912ac1d5a0a8fa37a838a64c080dc Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 7 Apr 2026 22:49:14 +0100 Subject: [PATCH] add auto_respond_new_issues option to skip @mention requirement When enabled, the bot responds to all new issues without needing to be explicitly @mentioned. Useful for deployments where the bot should proactively handle every incoming issue. --- config.py | 1 + main.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index fa39a68..d39acf2 100644 --- a/config.py +++ b/config.py @@ -16,6 +16,7 @@ WORKSPACE_DIR: Path = Path(_cfg["bot"].get("workspace_dir", "/data/src/gitea-bot BOT_GIT_NAME: str = _cfg["bot"].get("git_name", BOT_USERNAME) BOT_GIT_EMAIL: str = _cfg["bot"].get("git_email", f"{BOT_USERNAME}@euphon.net") ALLOWED_OWNERS: list[str] = _cfg["bot"].get("allowed_owners", []) +AUTO_RESPOND_NEW_ISSUES: bool = _cfg["bot"].get("auto_respond_new_issues", False) # Claude CLAUDE_COMMAND: str = _cfg["claude"]["command"] diff --git a/main.py b/main.py index 0551362..4918fad 100644 --- a/main.py +++ b/main.py @@ -243,11 +243,11 @@ async def webhook(request: Request): issue = payload["issue"] if issue["user"]["login"] == config.BOT_USERNAME: return {"status": "skip", "reason": "own issue"} - if not is_mentioned(issue.get("body", "")): + if not config.AUTO_RESPOND_NEW_ISSUES and not is_mentioned(issue.get("body", "")): return {"status": "skip", "reason": "not mentioned"} issue_number = issue["number"] - log.info(f"Mentioned in new issue {owner}/{repo}#{issue_number}") + log.info(f"New issue {owner}/{repo}#{issue_number}") asyncio.create_task( process_mention(owner, repo, issue_number, None, None) )