Skip to content

[refactoring] Create asset upload and discussion creation pattern skill #10768

@github-actions

Description

@github-actions

Skill Overview

Create a shared component that documents the standard workflow pattern for uploading charts/assets and embedding them in GitHub Discussions. Currently 15-20 workflows repeat similar instructions for this pattern, leading to inconsistency and duplication.

Current Usage

This pattern appears in the following workflows:

  • daily-code-metrics.md (lines 203-231) - Uploads 6 charts, embeds in discussion
  • daily-issues-report.md (lines 228-263) - Uploads 2 charts, embeds in discussion
  • deep-report.md - Creates discussion with assets
  • copilot-session-insights.md - Uploads session charts
  • python-data-charts.md - Chart generation and upload
  • daily-performance-summary.md - Performance visualizations
  • daily-observability-report.md - Observability charts
  • daily-team-evolution-insights.md - Team activity charts
  • copilot-pr-nlp-analysis.md - NLP visualization charts
  • prompt-clustering-analysis.md - Clustering visualizations
  • repo-tree-map.md - Repository treemap visualization
  • portfolio-analyst.md - Portfolio charts
  • static-analysis-report.md - Analysis charts
  • video-analyzer.md - Video analysis frames
  • org-health-report.md - Organization health charts

Estimated: 15-20 workflows create discussions with uploaded assets

Proposed Shared Component

File: .github/workflows/shared/asset-discussion-pattern.md

Configuration:

---
# Asset Upload and Discussion Creation Pattern
# Standardized workflow for uploading charts/assets and embedding in discussions
---

# Asset Upload and Discussion Creation Pattern

This shared component provides a standardized pattern for workflows that generate visualizations or other assets and publish them in GitHub Discussions.

## Prerequisites

Your workflow must have safe-outputs configured:

``````yaml
safe-outputs:
  upload-asset:
  create-discussion:
    category: "General"  # or "audits", "reports", etc.
    max: 1
    close-older-discussions: true  # Optional: close previous reports
    expires: 3d  # Optional: auto-close after 3 days

Standard Workflow Pattern

Phase 1: Generate Assets

Generate your charts, images, or other assets:

# Example: Generate charts with Python
python3 /tmp/gh-aw/python/generate_charts.py

# Verify assets exist
ls -lh /tmp/gh-aw/python/charts/*.png

Chart Quality Standards (for image assets):

  • DPI: 300 minimum
  • Figure Size: 12x7 inches (or appropriate for content)
  • Format: PNG with transparent or white background
  • File Size: < 5MB recommended

Phase 2: Upload Assets

Upload each asset and collect the returned URLs:

# Upload assets using the upload asset tool
# The tool returns a URL for each uploaded file

# For each chart/asset:
# 1. Call: upload asset with path /tmp/gh-aw/python/charts/chart1.png
# 2. Collect the returned URL (e.g., https://raw.githubusercontent.com/...)
# 3. Store URL for use in discussion markdown

# Example workflow:
# - Upload chart1.png → Get URL1
# - Upload chart2.png → Get URL2
# - Upload chart3.png → Get URL3

Important Notes:

  • Asset URLs are published to an orphaned git branch
  • URLs become accessible after workflow completion
  • Assets persist indefinitely (no expiration)
  • Use descriptive filenames (e.g., issue_activity_trends.png not chart1.png)

Phase 3: Create Discussion with Embedded Assets

Create a discussion with embedded asset URLs:

# Example Discussion Body

Brief 2-3 paragraph summary of key findings.

## 📊 Visualizations

### Chart 1: Descriptive Title
![Chart 1 Description](URL_FROM_UPLOAD_ASSET_1)

[2-3 sentence analysis of what the chart shows]

### Chart 2: Descriptive Title
![Chart 2 Description](URL_FROM_UPLOAD_ASSET_2)

[Analysis of second chart]

<details>
<summary><b>📈 Detailed Analysis</b></summary>

## Additional Charts

### Chart 3: Descriptive Title
![Chart 3 Description](URL_FROM_UPLOAD_ASSET_3)

## Detailed Metrics

[Tables, lists, additional data]

</details>

---
*Report generated by [Workflow Name] workflow*
*Run: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*

Discussion Configuration Best Practices

Title Formatting

Use descriptive, dated titles:

  • Good: Daily Code Metrics Report - 2026-01-20
  • Good: [daily-issues] Issue Analysis - 2026-01-20
  • Avoid: Report, Analysis (too generic)

Category Selection

Choose appropriate categories:

  • General: Informational reports, summaries
  • audits: Security, compliance, health checks
  • reports: Data analysis, metrics, trends
  • Q&A: Question-based reports requiring response

Close Older Discussions

For daily/weekly reports, use close-older-discussions: true:

  • Keeps discussions clean (only latest visible)
  • Previous reports remain accessible via search
  • Reduces notification noise

Expiration

Set expires for time-sensitive reports:

  • expires: 3d: Daily reports (closed after 3 days)
  • expires: 7d: Weekly reports
  • No expiration: Permanent reference reports

Common Patterns

Pattern 1: Multiple Charts with Analysis

## 📊 Visualizations

### Chart Title 1
![Description](URL1)
[Analysis]

### Chart Title 2  
![Description](URL2)
[Analysis]

<details>
<summary><b>Additional Charts</b></summary>

### Chart Title 3
![Description](URL3)
[Analysis]

</details>

Pattern 2: Single Hero Chart + Details

## Overview

![Main Visualization](URL)

[2-3 paragraph analysis of the main chart]

<details>
<summary><b>📈 Detailed Breakdown</b></summary>

### Supporting Chart 1
![Supporting 1](URL2)

### Supporting Chart 2
![Supporting 2](URL3)

</details>

Pattern 3: Comparison Charts

## Comparison Analysis

| Metric | Current | Previous | Change |
|--------|---------|----------|--------|
| X      | 100     | 90       | ⬆️ +11% |

### Trend Visualization
![Trends](URL1)

### Distribution Comparison
![Distribution](URL2)

Troubleshooting

Asset URLs Not Working

Problem: Markdown shows broken image icon
Solution:

  • Verify upload asset tool returned success
  • Check URL format (should be https://raw.githubusercontent.com/...)
  • Wait for workflow to complete (assets publish at end)
  • Verify file exists at uploaded path

Discussion Not Created

Problem: Workflow completes but no discussion appears
Solution:

  • Check safe-outputs.create-discussion is configured
  • Verify category exists in repository
  • Check max limit not exceeded
  • Review workflow logs for errors

Charts Not Displaying Correctly

Problem: Charts too small, blurry, or distorted
Solution:

  • Use DPI 300 minimum
  • Set appropriate figure size (12x7 recommended)
  • Save with bbox_inches='tight'
  • Use PNG format, not JPEG

Examples

See these workflows for complete implementations:

  • daily-code-metrics.md - 6 charts with trend analysis
  • daily-issues-report.md - 2 charts with clustering
  • copilot-session-insights.md - Session activity charts

Migration Checklist

To adopt this pattern in an existing workflow:

  • Configure safe-outputs.upload-asset and safe-outputs.create-discussion
  • Generate assets to standard path (e.g., /tmp/gh-aw/python/charts/)
  • Upload each asset and collect URLs
  • Create discussion body with embedded image markdown
  • Test workflow to verify assets display correctly
  • Verify old discussions close if close-older-discussions: true

## Impact

- **Workflows affected**: 15-20 workflows creating discussions with assets
- **Lines saved**: ~30-40 lines per workflow (total: ~450-800 lines)
- **Maintenance benefit**: Single source of truth for asset upload pattern
- **Consistency benefit**: All discussions follow same format and structure
- **Quality benefit**: Standardized chart quality requirements
- **Documentation benefit**: Troubleshooting guide for common issues

## Implementation Plan

1. [ ] Create `shared/asset-discussion-pattern.md` with standard pattern documentation
2. [ ] Document Phase 1 (Generate), Phase 2 (Upload), Phase 3 (Create Discussion)
3. [ ] Include chart quality standards and best practices
4. [ ] Provide markdown templates for different report styles
5. [ ] Add troubleshooting section for common issues
6. [ ] Include discussion configuration best practices
7. [ ] Update `daily-code-metrics.md` to import shared pattern (pilot)
8. [ ] Update `daily-issues-report.md` to import shared pattern
9. [ ] Add cross-references to existing shared components (`python-dataviz.md`, `reporting.md`)
10. [ ] Test pilot workflows to ensure compatibility
11. [ ] Document migration checklist for other workflows
12. [ ] Gradually migrate remaining workflows

## Related Analysis

This recommendation comes from the Workflow Skill Extractor analysis run on 2026-01-20.

**Key Finding**: Many workflows generate visualizations and publish them in discussions, but each implements the pattern independently:
- Inconsistent discussion formatting
- Repeated upload instructions (30-40 lines each)
- No standardized troubleshooting guidance
- Varied chart quality standards

This shared skill provides:
- Standard 3-phase pattern (Generate → Upload → Discuss)
- Quality standards for charts
- Markdown templates for common layouts
- Troubleshooting guide
- Migration checklist

**References**:
- Analysis discussion: [Link to discussion when created]
- Example: `daily-code-metrics.md` lines 203-231
- Related: `shared/python-dataviz.md` (chart generation)
- Related: `shared/reporting.md` (report formatting)




> AI generated by [Workflow Skill Extractor](https://github.com/githubnext/gh-aw/actions/runs/21155509188)

<!-- gh-aw-agentic-workflow: Workflow Skill Extractor, engine: copilot, run: https://github.com/githubnext/gh-aw/actions/runs/21155509188 -->

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions