Skip to content

[q] Add Charts with Trending Shared Workflow #3665

Description

@github-actions

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/logs/
  • Workflows Examined: 15+ chart-generating workflows
  • Request Origin: Discussion comment "/q add charts share agentic workflow and make sure to leverage cache memory for trending"

Summary: Created a comprehensive shared workflow that combines chart generation with trending analysis and cache-memory persistence, addressing the need for a shareable agentic workflow for charts with trending capabilities.

AI generated by Q


Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available as an artifact (aw.patch) in the workflow run linked above.
To apply the patch locally:

# Download the artifact from the workflow run https://github.com/githubnext/gh-aw/actions/runs/19278767818
# (Use GitHub MCP tools if gh CLI is not available)
gh run download 19278767818 -n aw.patch
# Apply the patch
git am aw.patch
Show patch preview (500 of 626 lines)
From cfe1fac8a094c7cb7470866ddd4f378c59ae4d6b Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 11 Nov 2025 21:23:32 +0000
Subject: [PATCH] Add charts-with-trending shared workflow with cache-memory
 integration

- Created new shared/charts-with-trending.md workflow
- Combines python-dataviz and trends imports
- Adds comprehensive cache-memory integration for trending data
- Provides JSON Lines format for time-series data persistence
- Includes helper functions for loading/saving trending data
- Updated python-data-charts.md to use new shared workflow
- Enhanced workflow with trending analysis capabilities

Addresses: Add charts share agentic workflow with cache memory for trending
---
 .github/workflows/python-data-charts.md       |  94 ++--
 .../workflows/shared/charts-with-trending.md  | 419 ++++++++++++++++++
 2 files changed, 479 insertions(+), 34 deletions(-)
 create mode 100644 .github/workflows/shared/charts-with-trending.md

diff --git a/.github/workflows/python-data-charts.md b/.github/workflows/python-data-charts.md
index 4f26109..5bb8a2f 100644
--- a/.github/workflows/python-data-charts.md
+++ b/.github/workflows/python-data-charts.md
@@ -11,7 +11,7 @@ tools:
   agentic-workflows:
   edit:
 imports:
-  - shared/python-dataviz.md
+  - shared/charts-with-trending.md
 safe-outputs:
   upload-assets:
   create-discussion:
@@ -22,11 +22,11 @@ timeout-minutes: 15
 
 # Python Data Visualization Generator
 
-You are a data visualization expert specializing in Python-based chart generation using scientific computing libraries.
+You are a data visualization expert specializing in Python-based chart generation using scientific computing libraries with trending analysis capabilities.
 
 ## Mission
 
-Generate high-quality data visualizations with random sample data, upload charts as assets, and create a discussion with embedded images.
+Generate high-quality data visualizations with sample data, track tren
... (truncated)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions