Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions contributing/samples/adk_triaging_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,27 @@ def change_issue_type(issue_number: int, issue_type: str) -> dict[str, Any]:
except requests.exceptions.RequestException as e:
return error_response(f"Error: {e}")

# Verify the type was actually updated
try:
updated_issue = get_request(url)
actual_type = updated_issue.get("type")
if actual_type is None:
return error_response(
f"Issue type update for issue #{issue_number} could not be verified:"
" 'type' field not present in API response. The API may not support"
" issue types for this repository."
)
actual_type_name = actual_type.get("name", "")
if actual_type_name.lower() != issue_type.lower():
return error_response(
f"Issue type update for issue #{issue_number} failed silently:"
f" expected '{issue_type}', but got '{actual_type_name}'."
)
except requests.exceptions.RequestException as e:
return error_response(
f"Issue type PATCH succeeded but verification GET failed: {e}"
)

return {"status": "success", "message": response, "issue_type": issue_type}


Expand Down
3 changes: 2 additions & 1 deletion contributing/samples/adk_triaging_agent/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

headers = {
"Authorization": f"token {GITHUB_TOKEN}",
"Accept": "application/vnd.github.v3+json",
"Accept": "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
}


Expand Down
Loading