Skip to content

Add charts-with-trending shared workflow with cache-memory integration#3673

Merged
pelikhan merged 3 commits into
mainfrom
copilot/add-trending-shared-workflow
Nov 11, 2025
Merged

Add charts-with-trending shared workflow with cache-memory integration#3673
pelikhan merged 3 commits into
mainfrom
copilot/add-trending-shared-workflow

Conversation

Copilot AI commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

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.md

    • Imports python-dataviz.md (Python env + scientific libraries) and trends.md (visualization patterns)
    • Configures cache-memory with workflow-specific keys for persistence
    • Provides JSON Lines format helpers for time-series data storage
    • Documents standardized directory structure: /tmp/gh-aw/cache-memory/trending/<metric>/history.jsonl
  • Updated: .github/workflows/python-data-charts.md

    • Import changed: shared/python-dataviz.mdshared/charts-with-trending.md
    • Added phases for historical data retrieval, cache updates, and trend visualization

Usage

imports:
  - shared/charts-with-trending.md

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.md can 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:

  • Run ID 19201666579 (Nov 9, 2025) - Successful execution
  • Run ID 19161200282 (Nov 7, 2025) - Successful execution
  • Run ID 19145393377 (Nov 6, 2025) - Successful execution
  • Run ID 19079896843 (Nov 4, 2025) - Successful execution

Key Findings:

  1. Missing Shared Workflow: No unified shared workflow exists for chart generation with trending capabilities
  2. Inconsistent Cache-Memory Usage: Multiple workflows generate charts but don't consistently leverage cache-memory for trending data
  3. Repeated Patterns: Similar chart generation code and trending logic duplicated across 15+ workflows
  4. Import Gaps: python-data-charts.md imports python-dataviz.md but not trends.md, missing trending capabilities

Changes Made

1. Created .github/workflows/shared/charts-with-trending.md

Purpose: Comprehensive shared workflow combining chart generation with trending analysis and cache-memory integration.

Features:

  • Imports both python-dataviz.md and trends.md for complete functionality
  • Configured cache-memory with workflow-specific keys for persistence
  • Provides JSON Lines format for efficient time-series data storage
  • Includes helper functions for loading/saving trending data
  • Comprehensive examples for daily metrics tracking, moving averages, and comparative trends
  • Best practices for data retention and cache organization

Benefits:

  • Reusable: Single import provides all trending and charting capabilities
  • Persistent: Cache-memory automatically persists trending data across runs
  • Efficient: JSON Lines format allows append-only operations for time-series
  • Well-Documented: Complete examples and patterns for common use cases

2. Updated .github/workflows/python-data-charts.md

Changes:

  • Changed import from shared/python-dataviz.md to shared/charts-with-trending.md
  • Enhanced workflow instructions to leverage cache-memory for trending
  • Added phases for checking cache, updating historical data, and creating trend visualizations
  • Updated discussion template to include trending analysis section
  • Added cache status reporting

Impact:

  • Workflow now supports trending analysis out of the box
  • Historical data persists across runs via cache-memory
  • Charts can show progression over time instead of just point-in-time snapshots

Expected Improvements

Immediate Benefits

  • Single Import Solution: Workflows can now use shared/charts-with-trending.md for complete charting + trending
  • Cache-Memory Integration: Automatic persistence of trending data across workflow runs
  • Code Reuse: Reduces duplication across 15+ workflows that generate charts
  • Better Trending: Workflows can now track metrics over time with historical context

Future Opportunities

  • Migrate existing workflows to use the new shared workflow:
    • audit-workflows.md
    • daily-news.md
    • daily-repo-chronicle.md
    • daily-firewall-report.md
    • weekly-issue-summary.md
    • copilot-pr-nlp-analysis.md
    • copilot-session-insights.md
    • And 8+ others

Validation

All modified workflows compiled successfully using the compile tool from gh-aw MCP server:

  • ✅ python-data-charts.md (compiled to 267.5 KB)

Note: .lock.yml files will be generated automatically after merge via the tidy workflow.

Implementation Details

Cache-Memory Structure

/tmp/gh-aw/cache-memory/
├── trending/
│   ├── (metric-name)/
│   │   ├── history.jsonl      # Time-series data (JSON Lines)
│   │   ├── metadata.json      # Schema and descriptions
│   │   └── last_updated.txt   # Update timestamp
│   └── index.json             # Metric index

JSON Lines Format

Each line in history.jsonl is 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:

  • Append-only: New data just adds a line
  • Efficient: Load with pd.read_json(file, lines=True)
  • Robust: Corruption affects only one line
  • Standard: Widely supported format

Example Usage

imports:
  - shared/charts-with-trending.md

This single import provides:

  • Python environment (NumPy, Pandas, Matplotlib, Seaborn, SciPy)
  • Chart generation best practices
  • Trending analysis patterns
  • Cache-memory configuration
  • Helper functions and examples

References

  • Analysis Source: `/tmp/gh-aw/aw-mcp...

💡 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.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add charts with trending shared workflow Add charts-with-trending shared workflow with cache-memory integration Nov 11, 2025
Copilot AI requested a review from pelikhan November 11, 2025 23:17
@pelikhan pelikhan marked this pull request as ready for review November 11, 2025 23:33
Copilot AI review requested due to automatic review settings November 11, 2025 23:33
@pelikhan pelikhan merged commit 856a2c7 into main Nov 11, 2025
14 checks passed
@pelikhan pelikhan deleted the copilot/add-trending-shared-workflow branch November 11, 2025 23:35

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 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 imports charts-with-trending.md instead of just python-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 }}

Copilot AI Nov 11, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
key: charts-trending-${{ github.workflow }}-${{ github.run_id }}
key: charts-trending-${{ github.workflow }}

Copilot uses AI. Check for mistakes.

### Trending Data Organization

Organize your trending data in cache-memory:

Copilot AI Nov 11, 2025

Copy link

Choose a reason for hiding this comment

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

[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.

Copilot uses AI. Check for mistakes.
- **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)

Copilot AI Nov 11, 2025

Copy link

Choose a reason for hiding this comment

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

[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.

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

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.

[q] Add Charts with Trending Shared Workflow

3 participants