Skip to content

add azurebot example#263

Open
itayd wants to merge 1 commit intomainfrom
itay/azurebot
Open

add azurebot example#263
itayd wants to merge 1 commit intomainfrom
itay/azurebot

Conversation

@itayd
Copy link
Member

@itayd itayd commented Aug 27, 2025

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +52
while True:
evt = next_event(sub)
print(evt)

text = evt.text.lower()

Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
while True:
evt = next_event(sub)
print(evt)

Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if not hasattr(evt, "text") or evt.text is None:
continue

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants