Skip to content

feat: GitHub issue analysis → Teams notification workflow#339

Merged
heyitsaamir merged 12 commits intomainfrom
issue-analysis-workflow
Apr 2, 2026
Merged

feat: GitHub issue analysis → Teams notification workflow#339
heyitsaamir merged 12 commits intomainfrom
issue-analysis-workflow

Conversation

@heyitsaamir
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a GitHub Actions workflow that automatically analyzes new issues and sends results to a Teams channel
  • Uses GitHub Models API (GPT-4o) for quick triage → Adaptive Card summary
  • Uses GitHub Copilot CLI with full repo context for deep analysis → threaded markdown reply
  • Supports manual trigger via workflow_dispatch for any issue number

How it works

  1. Triage (GPT-4o, free): Categorizes the issue (bug/feature/question), assigns severity, identifies affected packages
  2. Analysis (Copilot CLI): Reads the actual codebase to produce root cause, files to investigate, proposed approach, and complexity estimate
  3. Teams notification: Sends triage as an Adaptive Card, then threads the Copilot analysis as a reply

Files

  • .github/workflows/issue-analysis.yml — workflow definition
  • .github/scripts/analyze_issue.py — triage, card building, and Teams messaging

Required secrets

Secret Purpose
TEAMS_CLIENT_ID Azure AD app client ID
TEAMS_CLIENT_SECRET Azure AD app client secret
TEAMS_TENANT_ID Azure AD tenant ID
TEAMS_CONVERSATION_ID Teams channel/chat ID
COPILOT_PAT PAT with Copilot Requests permission

GITHUB_TOKEN is automatic (provides GitHub Models API access).

Test plan

  • Tested successfully in a fork

heyitsaamir and others added 10 commits March 31, 2026 13:25
Adds a GitHub Actions workflow that analyzes newly opened issues using
the GitHub Models API (GPT-4o) and sends a rich Adaptive Card summary
to a Microsoft Teams channel via proactive messaging.

Supports both automatic triggers on issue open and manual dispatch
with a specific issue number.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The ubuntu-latest runner's system Python is externally managed,
so uv pip install --system fails. Use a venv instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When running from a fork, GITHUB_REPOSITORY points to the fork which
has no issues. Use GITHUB_UPSTREAM_REPO to fetch from the upstream.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ContainerStyle literal is lowercase ('emphasis' not 'Emphasis').

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Simpler and avoids Pydantic validation issues with card elements.
Drops microsoft-teams-cards dependency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Send two messages to Teams:
1. Adaptive Card with triage summary (category, severity, packages)
2. Markdown message with detailed action plan (root cause, files to
   investigate, proposed approach, estimated complexity)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the blind GPT-4o analysis call with GitHub Copilot CLI, which
can actually read the codebase (grep, glob, read files) to produce a
grounded action plan. GPT-4o is still used for the quick triage card.

Flow: Copilot CLI analyzes repo → writes analysis to file → Python
script reads it and sends both triage card + analysis to Teams.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Filter out the tool call lines (file reads, greps, globs) from the
Copilot output so only the final analysis is sent to Teams.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Thread the Copilot analysis under the triage card by constructing
a thread conversation ID: {channelId};messageid={parentActivityId}

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of having the Python script re-fetch issue data from the API,
resolve all details in the workflow step (from event payload or gh API
for workflow_dispatch) and pass them as environment variables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pass user-controlled issue data (title, body, labels) through env vars
instead of direct ${{ }} interpolation in shell to prevent injection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rajan-chari
Copy link
Copy Markdown
Contributor

LGTM. Ship it. :)

@rajan-chari
Copy link
Copy Markdown
Contributor

I really like that we are using our sdk to triage our sdk lol :)

@heyitsaamir heyitsaamir marked this pull request as ready for review April 2, 2026 19:05
Copilot AI review requested due to automatic review settings April 2, 2026 19:05
Copy link
Copy Markdown
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

Adds an automated GitHub Issues triage + analysis pipeline that runs in GitHub Actions and posts results into Microsoft Teams, integrating GitHub Models for quick JSON triage and Copilot CLI for deeper repo-aware analysis.

Changes:

  • Added a new GitHub Actions workflow to trigger on issues: opened and workflow_dispatch, run triage + Copilot analysis, then send notifications to Teams.
  • Added a Python script to call GitHub Models (GPT-4o) for structured triage, build an Adaptive Card, and send both the card and a follow-up message to Teams.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
.github/workflows/issue-analysis.yml Defines the end-to-end issue trigger, dependency setup, issue data extraction, Copilot CLI analysis, and script execution.
.github/scripts/analyze_issue.py Implements triage via GitHub Models, Adaptive Card construction, and Teams proactive messaging.

Copy link
Copy Markdown
Contributor

@rajan-chari rajan-chari left a comment

Choose a reason for hiding this comment

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

Ship it.

Use heredoc delimiters for all GITHUB_OUTPUT writes to prevent output
injection from issue titles/authors containing newlines or %. Add
try/except around triage JSON parsing with markdown fence extraction
and a safe fallback when the model returns invalid JSON.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@heyitsaamir heyitsaamir merged commit 77cacdb into main Apr 2, 2026
4 checks passed
@heyitsaamir heyitsaamir deleted the issue-analysis-workflow branch April 2, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants