Skip to content

Commit a26bfd8

Browse files
committed
fix(new-work): allow bot-assigned tickets in backlog query
Backlog query now matches tickets assigned to the bot (via BOT_JIRA_EMAIL) in addition to unassigned ones. Handles the case where the bot claimed a ticket but got interrupted before completing.
1 parent b782b9f commit a26bfd8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.claude/skills/new-work/new_work.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
BOT_BOARD_ID = os.environ.get("BOT_BOARD_ID", "")
2323
BOT_BOARD_NAME = os.environ.get("BOT_BOARD_NAME", "")
2424
BOT_INCLUDE_BACKLOG = os.environ.get("BOT_INCLUDE_BACKLOG", "").lower() in ("1", "true", "yes")
25+
BOT_JIRA_EMAIL = os.environ.get("BOT_JIRA_EMAIL", "")
2526
NOT_STARTED_STATUSES = ("New", "Backlog", "Refinement", "To Do")
2627

2728

@@ -113,9 +114,13 @@ def get_candidates():
113114

114115
if len(candidates) < 10 and BOT_INCLUDE_BACKLOG:
115116
existing_keys = {c["key"] for c in candidates}
117+
if BOT_JIRA_EMAIL:
118+
assignee_filter = f'AND (assignee is EMPTY OR assignee = "{BOT_JIRA_EMAIL}") '
119+
else:
120+
assignee_filter = "AND assignee is EMPTY "
116121
jql = (
117122
f"project = RHCLOUD AND labels = {BOT_LABEL} "
118-
f"AND assignee is EMPTY AND status IN ({status_list}) "
123+
f"{assignee_filter}AND status IN ({status_list}) "
119124
f"AND sprint is EMPTY "
120125
f"ORDER BY priority DESC, created ASC"
121126
)

0 commit comments

Comments
 (0)