Skip to content

Commit 6a1c90b

Browse files
llalitkumarrrxuanyang15
authored andcommitted
docs: Auto-Assignment GitHub Action for Issues
Merge #4966 Co-authored-by: Xuan Yang <xygoogle@google.com> COPYBARA_INTEGRATE_REVIEW=#4966 from llalitkumarrr:main ff7a846 PiperOrigin-RevId: 896062781
1 parent 114deef commit 6a1c90b

3 files changed

Lines changed: 31 additions & 35 deletions

File tree

.github/workflows/triage.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ jobs:
1717
if: >-
1818
github.repository == 'google/adk-python' && (
1919
github.event_name == 'schedule' ||
20-
github.event.action == 'opened' ||
21-
github.event.label.name == 'planned'
20+
github.event.action == 'opened'
2221
)
2322
permissions:
2423
issues: write

contributing/samples/adk_triaging_agent/agent.py

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
"workflow": "DeanChensj",
4343
}
4444

45+
46+
LABEL_TO_GTECH = [
47+
"klateefa",
48+
"llalitkumarrr",
49+
"surajksharma07",
50+
"sanketpatil06",
51+
]
52+
4553
LABEL_GUIDELINES = """
4654
Label rubric and disambiguation rules:
4755
- "documentation": Tutorials, README content, reference docs, or samples.
@@ -121,15 +129,13 @@ def list_untriaged_issues(issue_count: int) -> dict[str, Any]:
121129

122130
existing_component_labels = issue_labels & component_labels
123131
has_component = bool(existing_component_labels)
124-
has_planned = "planned" in issue_labels
125132

126133
# Determine what actions are needed
127134
needs_component_label = not has_component
128-
needs_owner = has_planned and not assignees
135+
needs_owner = not assignees
129136

130137
# Include issue if it needs any action
131138
if needs_component_label or needs_owner:
132-
issue["has_planned_label"] = has_planned
133139
issue["has_component_label"] = has_component
134140
issue["existing_component_label"] = (
135141
list(existing_component_labels)[0]
@@ -146,7 +152,6 @@ def list_untriaged_issues(issue_count: int) -> dict[str, Any]:
146152

147153
def add_label_to_issue(issue_number: int, label: str) -> dict[str, Any]:
148154
"""Add the specified component label to the given issue number.
149-
150155
Args:
151156
issue_number: issue number of the GitHub issue.
152157
label: label to assign
@@ -177,37 +182,30 @@ def add_label_to_issue(issue_number: int, label: str) -> dict[str, Any]:
177182
}
178183

179184

180-
def add_owner_to_issue(issue_number: int, label: str) -> dict[str, Any]:
181-
"""Assign an owner to the issue based on the component label.
185+
def assign_gtech_owner_to_issue(issue_number: int) -> dict[str, Any]:
186+
"""Assign an owner from the GTech team to the given issue number.
182187
183-
This should only be called for issues that have the 'planned' label.
188+
This is go to option irrespective of component label or planned label,
189+
as long as the issue needs an owner.
190+
191+
All unassigned issues will be considered for GTech ownership. Unassigned
192+
issues will seperated in two categories: issues with type "Bug" and issues
193+
with type "Feature". Then bug issues and feature issues will be equally
194+
assigned to the Gtech members in such a way that every day all members get
195+
equal number of bug and feature issues.
184196
185197
Args:
186198
issue_number: issue number of the GitHub issue.
187-
label: component label that determines the owner to assign
188199
189200
Returns:
190201
The status of this request, with the assigned owner when successful.
191202
"""
192-
print(
193-
f"Attempting to assign owner for label '{label}' to issue #{issue_number}"
194-
)
195-
if label not in LABEL_TO_OWNER:
196-
return error_response(
197-
f"Error: Label '{label}' is not a valid component label."
198-
)
199-
200-
owner = LABEL_TO_OWNER.get(label, None)
201-
if not owner:
202-
return {
203-
"status": "warning",
204-
"message": f"Label '{label}' does not have an owner. Will not assign.",
205-
}
206-
203+
print(f"Attempting to assign GTech owner to issue #{issue_number}")
204+
gtech_assignee = LABEL_TO_GTECH[issue_number % len(LABEL_TO_GTECH)]
207205
assignee_url = (
208206
f"{GITHUB_BASE_URL}/repos/{OWNER}/{REPO}/issues/{issue_number}/assignees"
209207
)
210-
assignee_payload = {"assignees": [owner]}
208+
assignee_payload = {"assignees": [gtech_assignee]}
211209

212210
try:
213211
response = post_request(assignee_url, assignee_payload)
@@ -217,7 +215,7 @@ def add_owner_to_issue(issue_number: int, label: str) -> dict[str, Any]:
217215
return {
218216
"status": "success",
219217
"message": response,
220-
"assigned_owner": owner,
218+
"assigned_owner": gtech_assignee,
221219
}
222220

223221

@@ -259,7 +257,7 @@ def change_issue_type(issue_number: int, issue_type: str) -> dict[str, Any]:
259257
260258
Each issue will have flags indicating what actions are needed:
261259
- `needs_component_label`: true if the issue needs a component label
262-
- `needs_owner`: true if the issue needs an owner assigned (has 'planned' label but no assignee)
260+
- `needs_owner`: true if the issue needs an owner assigned
263261
264262
For each issue, perform ONLY the required actions based on the flags:
265263
@@ -271,8 +269,8 @@ def change_issue_type(issue_number: int, issue_type: str) -> dict[str, Any]:
271269
- Otherwise → do not change the issue type
272270
273271
2. **If `needs_owner` is true**:
274-
- Use `add_owner_to_issue` to assign an owner based on the component label
275-
- Note: If the issue already has a component label (`has_component_label: true`), use that existing label to determine the owner
272+
- Use `assign_gtech_owner_to_issue` to assign an owner.
273+
276274
277275
Do NOT add a component label if `needs_component_label` is false.
278276
Do NOT assign an owner if `needs_owner` is false.
@@ -282,19 +280,18 @@ def change_issue_type(issue_number: int, issue_type: str) -> dict[str, Any]:
282280
placeholders (never output text like "[fill in later]").
283281
- Justify the chosen label with a short explanation referencing the issue
284282
details.
285-
- Mention the assigned owner only when you actually assign one (i.e., when
286-
the issue has the 'planned' label).
283+
- Mention the assigned owner only when you actually assign one.
287284
- If no label is applied, clearly state why.
288285
289286
Present the following in an easy to read format highlighting issue number and your label.
290287
- the issue summary in a few sentence
291288
- your label recommendation and justification
292-
- the owner of the label if you assign the issue to an owner (only for planned issues)
289+
- the owner, if you assign the issue to an owner
293290
""",
294291
tools=[
295292
list_untriaged_issues,
296293
add_label_to_issue,
297-
add_owner_to_issue,
294+
assign_gtech_owner_to_issue,
298295
change_issue_type,
299296
],
300297
)

contributing/samples/adk_triaging_agent/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def fetch_specific_issue_details(issue_number: int):
5757

5858
# Determine what actions are needed
5959
needs_component_label = not has_component
60-
needs_owner = has_planned and not has_assignee
60+
needs_owner = not has_assignee
6161

6262
if needs_component_label or needs_owner:
6363
print(

0 commit comments

Comments
 (0)