Skip to content

Add shared issues-data-fetch workflow and daily issues report - #4810

Merged
pelikhan merged 3 commits into
mainfrom
copilot/create-shared-agentic-workflow
Nov 26, 2025
Merged

pelikhan merged 3 commits into
mainfrom
copilot/create-shared-agentic-workflow

Conversation

Copilot AI commented Nov 26, 2025 •

Copy link
Copy Markdown
Contributor

Adds a reusable shared workflow that downloads the last 1000 issues and caches them for downstream analysis, along with a daily issues report workflow that uses Python for clustering and visualization.

Changes

New shared component: .github/workflows/shared/issues-data-fetch.md

  • Fetches up to 1000 issues (open + closed) via gh issue list
  • Date-based caching in /tmp/gh-aw/cache-memory/ to avoid redundant API calls
  • Auto-generates JSON schema via jqschema.md
  • Prompt section with schema and usage examples

New workflow: .github/workflows/daily-issues-report.md

  • Scheduled daily at 6 AM UTC (also supports manual trigger)
  • Uses Python for issue clustering by keyword themes (Bug Reports, Feature Requests, Documentation, Testing, Refactoring, Security, Performance, Other)
  • Calculates metrics: open/closed rates, response times, label distribution, stale issues
  • Generates 2 trend charts: issue activity over time + cluster distribution (horizontal bar)
  • Creates new discussion with [daily issues] title prefix
  • Closes previous daily issues discussions with "OUTDATED" reason
  • Imports: issues-data-fetch.md, python-dataviz.md, trends.md, reporting.md, jqschema.md

Usage

Using issues-data-fetch shared component

---
on: workflow_dispatch
engine: copilot
imports:
  - shared/jqschema.md
  - shared/issues-data-fetch.md
---

# Analyze issues from /tmp/gh-aw/issues-data/issues.json

Daily issues report runs automatically

The daily-issues-report.md workflow runs on schedule and can also be triggered manually via workflow_dispatch.

Output

issues-data-fetch

  • /tmp/gh-aw/issues-data/issues.json — raw issues data
  • /tmp/gh-aw/issues-data/issues-schema.json — generated schema

daily-issues-report

  • Creates a GitHub Discussion with comprehensive analysis
  • Uploads trend charts as assets embedded in the discussion
  • Closes previous [daily issues] discussions automatically

Custom agent used: create-shared-agentic-workflow
Create shared agentic workflow components that wrap MCP servers using GitHub Agentic Workflows (gh-aw) with Docker best practices.

Original prompt

Create a shared agentic workflow that download the last 1000 issues and puts them on a cache folder, unfiltered. It provides a prompt with the schema.

Custom agent used: create-shared-agentic-workflow
Create shared agentic workflow components that wrap MCP servers using GitHub Agentic Workflows (gh-aw) with Docker best practices.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 26, 2025
Copilot AI changed the title [WIP] Create workflow to download last 1000 issues unfiltered Add shared issues-data-fetch workflow component Nov 26, 2025
Copilot AI requested a review from pelikhan November 26, 2025 05:02
@pelikhan

Copy link
Copy Markdown
Collaborator

Add an agentic workflow that generate a daily report about issues in the report.

  • use python to cluster issues
  • identify clusters, various metrics
  • show trend charts
  • new discussion
  • close previous discussion
  • title prefix "[daily issues] "

Use existing shared agentic workflows

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot apply comment

Copilot AI commented Nov 26, 2025

Copy link
Copy Markdown
Contributor Author

Add an agentic workflow that generate a daily report about issues in the report.

  • use python to cluster issues...

Created the daily-issues-report.md workflow in commit 78014b7.

Features:

  • Scheduled daily at 6 AM UTC (with manual trigger option)
  • Uses Python for clustering issues by keyword themes (Bug Reports, Feature Requests, Documentation, etc.)
  • Calculates metrics: open/closed rates, time to close, label distribution, stale issues
  • Generates 2 trend charts: issue activity over time + cluster distribution (horizontal bar)
  • Creates new discussion with [daily issues] title prefix
  • Closes previous daily issues discussions with "OUTDATED" reason

Imports:

  • shared/issues-data-fetch.md (the new shared component)
  • shared/python-dataviz.md
  • shared/trends.md
  • shared/reporting.md
  • shared/jqschema.md

Copilot AI changed the title Add shared issues-data-fetch workflow component Add shared issues-data-fetch workflow and daily issues report Nov 26, 2025
@pelikhan
pelikhan marked this pull request as ready for review November 26, 2025 05:58
Copilot AI review requested due to automatic review settings November 26, 2025 05:58
@pelikhan
pelikhan merged commit 2856811 into main Nov 26, 2025
@pelikhan
pelikhan deleted the copilot/create-shared-agentic-workflow branch November 26, 2025 05:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 infrastructure for daily issue analysis through two new workflow files: a reusable shared component for fetching and caching issue data, and a scheduled workflow that performs clustering analysis and generates reports. However, the PR contains several critical bugs that will prevent the daily-issues-report workflow from functioning correctly.

Key Changes:

  • New shared component issues-data-fetch.md that fetches up to 1000 issues with date-based caching
  • New workflow daily-issues-report.md scheduled daily at 6 AM UTC for issue clustering and trend analysis
  • Integration with Python for data analysis and visualization

Reviewed changes

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

File Description
.github/workflows/shared/issues-data-fetch.md Shared component for fetching and caching issue data; has security issues with unquoted variables and template injection risks
.github/workflows/daily-issues-report.md Daily scheduled workflow for issue analysis; contains critical bugs with invalid safe-outputs (upload-assets, close-discussion) that don't exist in gh-aw, and broken chart upload mechanism

Critical Issues Found:

  1. Invalid safe-outputs: upload-assets and close-discussion are not valid safe output types in gh-aw
  2. Broken chart workflow: Instructions reference non-existent upload tools, resulting in broken image placeholders in discussions
  3. Security concerns: Template injection vulnerability and missing bash strict mode in issues-data-fetch.md
  4. Python errors: Incomplete error handling that will cause runtime failures with empty datasets

Recommendation: This PR needs significant rework before it can be merged. The chart upload mechanism must be redesigned, and invalid safe-outputs must be replaced with valid alternatives or direct GitHub tool usage.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

issues_30d = len(df[df['createdAt'] > now - timedelta(days=30)])

# Average time to close
closed_df = df[df['closedAt'].notna()]

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The Python script has incomplete error handling. The avg_close_time variable is calculated inside an if len(closed_df) > 0: block but is referenced later in the metrics without being defined when there are no closed issues. This will cause a NameError at runtime when trying to serialize metrics to JSON if there are no closed issues in the dataset.

Consider initializing avg_close_time = None before the conditional block or including it in the metrics dictionary only when it exists.

Suggested change
closed_df = df[df['closedAt'].notna()]
closed_df = df[df['closedAt'].notna()]
avg_close_time = None

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +77
Create a Python script to analyze and cluster the issues. Use scikit-learn for clustering if available, or implement simple keyword-based clustering.

### Required Analysis

**Clustering Requirements**:
- Use TF-IDF vectorization on issue titles and bodies
- Apply K-means or hierarchical clustering
- Identify 5-10 major issue clusters/themes
- Label each cluster based on common keywords

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The comment on line 71 says "Use scikit-learn for clustering if available, or implement simple keyword-based clustering" but the actual Python script example (lines 142-161) only shows keyword-based clustering without any scikit-learn implementation. This creates an inconsistency between what's promised and what's demonstrated.

The requirements on lines 73-77 also specify TF-IDF vectorization and K-means/hierarchical clustering which are scikit-learn features, but these are not implemented in the example code.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
close-discussion:
max: 10

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The close-discussion safe output is not a valid safe output type. The valid safe output types do not include discussion closing functionality. You would need to use the GitHub tools directly with appropriate permissions to close discussions.

Suggested change
close-discussion:
max: 10

Copilot uses AI. Check for mistakes.
Comment on lines +211 to +217
## Phase 4: Upload Charts

Use the `upload asset` tool to upload both charts:
1. Upload `/tmp/gh-aw/python/charts/issue_activity_trends.png`
2. Upload `/tmp/gh-aw/python/charts/issue_clusters.png`
3. Collect the returned URLs for embedding in the discussion

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

Inconsistent instruction about uploading assets. The instructions say to "Use the upload asset tool" but there is no such tool available. The frontmatter includes an invalid upload-assets safe output (line 19).

Since there's no built-in asset upload tool, these instructions should be updated to use an alternative approach, such as:

  1. Embedding charts directly in the discussion using base64 encoding
  2. Committing charts to a branch and linking to them
  3. Using a third-party service for image hosting

Alternatively, the workflow could be simplified to not include charts, or the instructions should clarify how to handle chart uploads with the available tools.

Suggested change
## Phase 4: Upload Charts
Use the `upload asset` tool to upload both charts:
1. Upload `/tmp/gh-aw/python/charts/issue_activity_trends.png`
2. Upload `/tmp/gh-aw/python/charts/issue_clusters.png`
3. Collect the returned URLs for embedding in the discussion
## Phase 4: Share Charts
Since there is no built-in asset upload tool, use one of the following supported methods to share the generated charts:
**Option 1: Embed charts directly in the discussion using base64 encoding**
- Convert each chart image (`/tmp/gh-aw/python/charts/issue_activity_trends.png` and `/tmp/gh-aw/python/charts/issue_clusters.png`) to a base64 string.
- Embed the images in the discussion using Markdown:


**Option 2: Commit charts to a branch and link to them**
- Commit the chart images to a branch in the repository (e.g., `charts/daily-YYYY-MM-DD/`).
- Link to the images in the discussion using Markdown:


**Option 3: Use a third-party image hosting service**
- Upload the chart images to a trusted image hosting service.
- Link to the hosted images in the discussion using Markdown:


Choose the method that best fits your workflow and repository policies. Embed or link the charts in the discussion report in Phase 6.

Copilot uses AI. Check for mistakes.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

Missing strict mode for bash script. According to the coding guidelines' security best practices, shell scripts should enable strict mode with set -euo pipefail to catch errors early. This ensures the script fails fast on errors, undefined variables, or pipe failures.

Suggested change
run: |
run: |
set -euo pipefail

Copilot uses AI. Check for mistakes.
github:
toolsets: [default, discussions]
safe-outputs:
upload-assets:

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The upload-assets safe output is not a valid safe output type according to the gh-aw documentation. Valid safe output types are: create-issue, create-discussion, add-comment, create-pull-request, create-pull-request-review-comment, update-issue, close-pull-request, noop, and missing-tool.

If you need to upload assets, you should use the GitHub tools directly rather than a safe output.

Suggested change
upload-assets:

Copilot uses AI. Check for mistakes.
actions: read
issues: read
pull-requests: read
discussions: write

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

According to the coding guidelines, when using safe-outputs.create-discussion, the main job does NOT need discussions: write permission since discussion creation is handled by a separate job with appropriate permissions. This permission should be removed for better security through permission separation.

Suggested change
discussions: write

Copilot uses AI. Check for mistakes.
2. Close each found discussion with reason "OUTDATED"
3. Add a closing comment: "This discussion has been superseded by a newer daily issues report."

Use the `close_discussion` safe output for each discussion found.

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

Inconsistent instruction about closing discussions. The frontmatter includes an invalid close-discussion safe output (line 24-25), but the instructions in Phase 5 (lines 219-226) tell the agent to "Use the close_discussion safe output" which doesn't exist.

Since there's no valid safe output for closing discussions, these instructions should be updated to use the GitHub tools directly (which are already enabled via toolsets: [default, discussions]).

Suggested change
Use the `close_discussion` safe output for each discussion found.
Use the GitHub discussions tool to close each discussion found.

Copilot uses AI. Check for mistakes.
Comment on lines +246 to +252
![Issue Activity Trends](URL_FROM_UPLOAD_ASSET_CHART_1)

[2-3 sentence analysis of activity trends - peaks, patterns, recent changes]

## 🏷️ Issue Clusters by Theme

![Issue Clusters](URL_FROM_UPLOAD_ASSET_CHART_2)

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The discussion template references placeholder URLs URL_FROM_UPLOAD_ASSET_CHART_1 and URL_FROM_UPLOAD_ASSET_CHART_2 (lines 246, 252) but there's no valid mechanism to upload assets and obtain these URLs. This will result in broken image links in the generated discussions.

Since the upload-assets safe output doesn't exist, these placeholders won't be replaced with actual URLs.

Suggested change
![Issue Activity Trends](URL_FROM_UPLOAD_ASSET_CHART_1)
[2-3 sentence analysis of activity trends - peaks, patterns, recent changes]
## 🏷️ Issue Clusters by Theme
![Issue Clusters](URL_FROM_UPLOAD_ASSET_CHART_2)
<!-- Chart image for Issue Activity Trends not available. -->
[2-3 sentence analysis of activity trends - peaks, patterns, recent changes]
## 🏷️ Issue Clusters by Theme
<!-- Chart image for Issue Clusters not available. -->

Copilot uses AI. Check for mistakes.
cache-memory:
key: issues-data
bash:
- "gh issue list *"

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The bash wildcard pattern "gh issue list *" should be quoted more specifically to prevent unintended globbing. Consider using "gh issue list *" or being more explicit about the allowed subcommands. According to security best practices, bash commands with wildcards should be carefully constrained.

Suggested change
- "gh issue list *"
- "gh issue list --state all --limit 1000"

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants