add auto_respond_new_issues option to skip @mention requirement
Some checks are pending
CI / check (push) Waiting to run
Some checks are pending
CI / check (push) Waiting to run
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.
This commit is contained in:
parent
dffdbf54f5
commit
b701d7ceec
@ -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"]
|
||||
|
||||
4
main.py
4
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)
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user