Repository navigation
Add shared issues-data-fetch workflow and daily issues report - #4810
Conversation
Co-authored-by: pelikhan <[email protected]>
|
Add an agentic workflow that generate a daily report about issues in the report.
Use existing shared agentic workflows |
|
@copilot apply comment |
…charts Co-authored-by: pelikhan <[email protected]>
Created the Features:
Imports:
|
There was a problem hiding this comment.
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.mdthat fetches up to 1000 issues with date-based caching - New workflow
daily-issues-report.mdscheduled 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:
- Invalid safe-outputs:
upload-assetsandclose-discussionare not valid safe output types in gh-aw - Broken chart workflow: Instructions reference non-existent upload tools, resulting in broken image placeholders in discussions
- Security concerns: Template injection vulnerability and missing bash strict mode in issues-data-fetch.md
- 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()] |
There was a problem hiding this comment.
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.
| closed_df = df[df['closedAt'].notna()] | |
| closed_df = df[df['closedAt'].notna()] | |
| avg_close_time = None |
| 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 |
There was a problem hiding this comment.
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.
| close-discussion: | ||
| max: 10 |
There was a problem hiding this comment.
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.
| close-discussion: | |
| max: 10 |
| ## 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 | ||
|
|
There was a problem hiding this comment.
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:
- Embedding charts directly in the discussion using base64 encoding
- Committing charts to a branch and linking to them
- 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.
| ## 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.
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | |
There was a problem hiding this comment.
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.
| run: | | |
| run: | | |
| set -euo pipefail |
| github: | ||
| toolsets: [default, discussions] | ||
| safe-outputs: | ||
| upload-assets: |
There was a problem hiding this comment.
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.
| upload-assets: |
| actions: read | ||
| issues: read | ||
| pull-requests: read | ||
| discussions: write |
There was a problem hiding this comment.
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.
| discussions: write |
| 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. |
There was a problem hiding this comment.
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]).
| Use the `close_discussion` safe output for each discussion found. | |
| Use the GitHub discussions tool to close each discussion found. |
|  | ||
|
|
||
| [2-3 sentence analysis of activity trends - peaks, patterns, recent changes] | ||
|
|
||
| ## 🏷️ Issue Clusters by Theme | ||
|
|
||
|  |
There was a problem hiding this comment.
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.
|  | |
| [2-3 sentence analysis of activity trends - peaks, patterns, recent changes] | |
| ## 🏷️ Issue Clusters by Theme | |
|  | |
| <!-- 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. --> |
| cache-memory: | ||
| key: issues-data | ||
| bash: | ||
| - "gh issue list *" |
There was a problem hiding this comment.
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.
| - "gh issue list *" | |
| - "gh issue list --state all --limit 1000" |


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.mdgh issue list/tmp/gh-aw/cache-memory/to avoid redundant API callsjqschema.mdNew workflow:
.github/workflows/daily-issues-report.md[daily issues]title prefixissues-data-fetch.md,python-dataviz.md,trends.md,reporting.md,jqschema.mdUsage
Using issues-data-fetch shared component
Daily issues report runs automatically
The
daily-issues-report.mdworkflow runs on schedule and can also be triggered manually viaworkflow_dispatch.Output
issues-data-fetch
/tmp/gh-aw/issues-data/issues.json— raw issues data/tmp/gh-aw/issues-data/issues-schema.json— generated schemadaily-issues-report
[daily issues]discussions automaticallyOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.