Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Azure Pipelines Bot example that integrates Azure DevOps with Microsoft Teams using AutoKitteh. The bot monitors build completions and enables interactive pipeline management through Teams conversations.
- Creates a webhook-triggered bot that receives Azure DevOps build completion notifications
- Implements interactive retry functionality for failed builds through Teams chat commands
- Provides complete project configuration with required environment variables and connections
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| azure_pipelines_bot/program.py | Main bot logic handling webhook events, Teams messaging, and build retry functionality |
| azure_pipelines_bot/autokitteh.yaml | Project configuration defining variables, connections, and webhook triggers |
| azure_pipelines_bot/README.md | Documentation explaining the bot's functionality, setup, and usage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1,26 @@ | |||
| # This YAML file is a declarative manifest that describes the setup | |||
| # of an AutoKitteh project that demonstrates how to poll for new emails | |||
There was a problem hiding this comment.
The comment describes polling for emails, but this project is about Azure DevOps build notifications and Teams integration. Update the comment to accurately describe this project's purpose.
| # of an AutoKitteh project that demonstrates how to poll for new emails | |
| # of an AutoKitteh project that integrates Azure DevOps build notifications with Microsoft Teams |
| while True: | ||
| evt = next_event(sub) | ||
| print(evt) | ||
|
|
||
| text = evt.text.lower() | ||
|
|
There was a problem hiding this comment.
The infinite loop lacks an exit condition, which could lead to resource exhaustion or difficulty in stopping the process. Consider adding a timeout, maximum iteration count, or explicit break condition for scenarios like conversation inactivity or specific commands.
| while True: | |
| evt = next_event(sub) | |
| print(evt) | |
| text = evt.text.lower() | |
| import time | |
| INACTIVITY_TIMEOUT = 300 # seconds (5 minutes) | |
| last_event_time = time.time() | |
| while True: | |
| # Try to get the next event, with a timeout for inactivity | |
| try: | |
| evt = next_event(sub) | |
| last_event_time = time.time() | |
| except Exception as e: | |
| print(f"Error receiving event: {e}") | |
| break | |
| print(evt) | |
| text = evt.text.lower() | |
| # Exit loop if user sends "exit" or "quit" | |
| if "exit" in text or "quit" in text: | |
| bot_client.send_conversation_activity( | |
| {"type": "message", "text": "Conversation ended by user."}, | |
| conversation_id=convo_id, | |
| ) | |
| break | |
| # Check for inactivity timeout | |
| if time.time() - last_event_time > INACTIVITY_TIMEOUT: | |
| bot_client.send_conversation_activity( | |
| {"type": "message", "text": "Conversation ended due to inactivity."}, | |
| conversation_id=convo_id, | |
| ) | |
| break |
| while True: | ||
| evt = next_event(sub) | ||
| print(evt) | ||
|
|
There was a problem hiding this comment.
Accessing evt.text without checking if the event has a text attribute could result in an AttributeError. Add a check to ensure the event contains text before attempting to access it.
| if not hasattr(evt, "text") or evt.text is None: | |
| continue |
No description provided.