Add charts-with-trending shared workflow with cache-memory integration#3673
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR consolidates chart generation and trending analysis capabilities into a single reusable shared workflow with persistent cache-memory storage. The new charts-with-trending.md shared workflow imports both python-dataviz.md and trends.md, adds cache-memory configuration for data persistence, and provides comprehensive documentation on using JSON Lines format for time-series trending data. The python-data-charts.md workflow has been updated to use this new shared workflow, enabling trending analysis capabilities.
Key Changes
- New shared workflow (
charts-with-trending.md): Combines Python visualization environment, trending patterns, and cache-memory configuration - Updated workflow (
python-data-charts.md): Now importscharts-with-trending.mdinstead of justpython-dataviz.md, gaining trending capabilities with cache-memory persistence - Enhanced instructions: Added phases for checking cache, updating historical data, and creating trend visualizations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/shared/charts-with-trending.md |
New shared workflow providing complete chart generation with trending analysis and cache-memory integration for persistent historical data tracking |
.github/workflows/python-data-charts.md |
Updated to import charts-with-trending.md instead of python-dataviz.md, adding trending analysis workflow phases |
.github/workflows/python-data-charts.lock.yml |
Compiled GitHub Actions YAML reflecting the new import structure and trending guide content |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| tools: | ||
| cache-memory: | ||
| key: charts-trending-${{ github.workflow }}-${{ github.run_id }} |
There was a problem hiding this comment.
The cache key includes github.run_id which makes every workflow run unique, preventing cache reuse across runs. This defeats the purpose of trending analysis which requires persistent historical data. According to the developer instructions for cache-memory, the key should omit github.run_id to enable cache persistence. Consider using: key: charts-trending-${{ github.workflow }} or just a static key like key: charts-trending for better cache hit rates.
| key: charts-trending-${{ github.workflow }}-${{ github.run_id }} | |
| key: charts-trending-${{ github.workflow }} |
|
|
||
| ### Trending Data Organization | ||
|
|
||
| Organize your trending data in cache-memory: |
There was a problem hiding this comment.
[nitpick] The cache-memory directory structure documentation suggests organizing data under /tmp/gh-aw/cache-memory/trending/, but the workflow doesn't provide specific guidance on how the cache-memory configuration maps to this directory. Consider adding a note that clarifies this is the recommended convention and that users should create these subdirectories in their code since the cache-memory mounts at /tmp/gh-aw/cache-memory/ by default.
| - **Data Directory**: `/tmp/gh-aw/python/data/` | ||
| - **Charts Directory**: `/tmp/gh-aw/python/charts/` | ||
| - **Cache Memory**: `/tmp/gh-aw/cache-memory/` | ||
| - **Cache Memory**: `/tmp/gh-aw/cache-memory/` (for trending data persistence) |
There was a problem hiding this comment.
[nitpick] The comment '(for trending data persistence)' is helpful but could be more specific. Consider clarifying that the cache persists across workflow runs via GitHub Actions cache, and that the first run will have no historical data. This would set better expectations for users.
| - **Cache Memory**: `/tmp/gh-aw/cache-memory/` (for trending data persistence) | |
| - **Cache Memory**: `/tmp/gh-aw/cache-memory/` (persists trending data across workflow runs via GitHub Actions cache; note: the first run will have no historical data) |
Consolidates chart generation and trending analysis into a single reusable shared workflow with persistent cache-memory storage for historical data tracking.
Changes
New:
.github/workflows/shared/charts-with-trending.mdpython-dataviz.md(Python env + scientific libraries) andtrends.md(visualization patterns)/tmp/gh-aw/cache-memory/trending/<metric>/history.jsonlUpdated:
.github/workflows/python-data-charts.mdshared/python-dataviz.md→shared/charts-with-trending.mdUsage
Single import provides Python scientific stack, chart generation best practices, trending patterns, and persistent cache-memory storage.
Data Format
JSON Lines for efficient append-only operations:
{"timestamp": "2025-11-11T21:00:00Z", "metric": "issue_count", "value": 42} {"timestamp": "2025-11-12T21:00:00Z", "metric": "issue_count", "value": 45}Migration Path
15+ workflows currently using
python-dataviz.mdcan adopt this for trending capabilities:audit-workflows.md,daily-news.md,weekly-issue-summary.md,copilot-session-insights.md, etc.Original prompt
This section details on the original issue you should resolve
<issue_title>[q] Add Charts with Trending Shared Workflow</issue_title>
<issue_description># Q Workflow Optimization Report
Issues Found (from live data)
Based on analysis of the Q workflow execution logs and the triggering request "/q add charts share agentic workflow and make sure to leverage cache memory for trending", I identified the following improvement opportunities:
Current State Analysis
Workflow Logs Analyzed:
Key Findings:
Changes Made
1. Created
.github/workflows/shared/charts-with-trending.mdPurpose: Comprehensive shared workflow combining chart generation with trending analysis and cache-memory integration.
Features:
python-dataviz.mdandtrends.mdfor complete functionalitycache-memorywith workflow-specific keys for persistenceBenefits:
2. Updated
.github/workflows/python-data-charts.mdChanges:
shared/python-dataviz.mdtoshared/charts-with-trending.mdImpact:
Expected Improvements
Immediate Benefits
shared/charts-with-trending.mdfor complete charting + trendingFuture Opportunities
Validation
All modified workflows compiled successfully using the
compiletool from gh-aw MCP server:Note: .lock.yml files will be generated automatically after merge via the tidy workflow.
Implementation Details
Cache-Memory Structure
JSON Lines Format
Each line in
history.jsonlis a complete JSON object:{"timestamp": "2025-11-11T21:00:00Z", "metric": "issue_count", "value": 42, "metadata": {}} {"timestamp": "2025-11-12T21:00:00Z", "metric": "issue_count", "value": 45, "metadata": {}}Advantages:
pd.read_json(file, lines=True)Example Usage
This single import provides:
References
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.