|
| 1 | +--- |
| 2 | +description: Creates weekly summary of issue activity including trends, charts, and insights every Monday |
| 3 | +timeout-minutes: 20 |
| 4 | +strict: true |
| 5 | +on: |
| 6 | + schedule: |
| 7 | + - cron: "0 15 * * 1" # Weekly on Mondays at 3 PM UTC |
| 8 | + workflow_dispatch: |
| 9 | +permissions: |
| 10 | + issues: read |
| 11 | +engine: copilot |
| 12 | +network: |
| 13 | + allowed: |
| 14 | + - defaults |
| 15 | + - python |
| 16 | +tools: |
| 17 | + edit: |
| 18 | + bash: |
| 19 | + - "*" |
| 20 | + github: |
| 21 | + lockdown: true |
| 22 | + toolsets: |
| 23 | + - issues |
| 24 | +safe-outputs: |
| 25 | + upload-asset: |
| 26 | + create-discussion: |
| 27 | + title-prefix: "[Weekly Summary] " |
| 28 | + category: "audits" |
| 29 | + close-older-discussions: true |
| 30 | +steps: |
| 31 | + - name: Setup Python environment |
| 32 | + run: | |
| 33 | + mkdir -p /tmp/charts /tmp/data |
| 34 | + pip install --user --quiet numpy pandas matplotlib seaborn scipy |
| 35 | + python3 -c "import pandas, matplotlib, seaborn; print('Python environment ready')" |
| 36 | +--- |
| 37 | + |
| 38 | +# Weekly Issue Summary |
| 39 | + |
| 40 | +Create a comprehensive weekly summary of issue activity for repository ${{ github.repository }}. |
| 41 | + |
| 42 | +## Step 1: Collect Issue Data |
| 43 | + |
| 44 | +Use GitHub API tools to gather data for the past 30 days: |
| 45 | + |
| 46 | +1. **Issue Activity Data** — Count of issues opened per day, closed per day, and running open count |
| 47 | +2. **Issue Resolution Data** — Average time to close issues, distribution of issue lifespans, breakdown by label |
| 48 | + |
| 49 | +Fetch enough issues to compute weekly and daily trends over the past 30 days. Use the GitHub toolset to query issues filtered by `created` and `closed` dates. |
| 50 | + |
| 51 | +## Step 2: Generate Trend Charts |
| 52 | + |
| 53 | +Write Python scripts to create exactly 2 high-quality trend charts and execute them via bash. |
| 54 | + |
| 55 | +### Chart 1: Issue Activity Trends |
| 56 | + |
| 57 | +Save data to `/tmp/data/issue_activity.csv` with columns: `date,opened,closed,open_total` |
| 58 | + |
| 59 | +Generate a multi-line chart: |
| 60 | +- Issues opened per week (bar or line) |
| 61 | +- Issues closed per week (bar or line) |
| 62 | +- Running total of open issues (secondary line) |
| 63 | +- X-axis: last 12 weeks, Y-axis: count |
| 64 | +- Save as `/tmp/charts/issue_activity_trends.png` at 300 DPI, 12×7 inches |
| 65 | +- Use seaborn whitegrid style with a professional color palette |
| 66 | + |
| 67 | +### Chart 2: Issue Resolution Time Trends |
| 68 | + |
| 69 | +Save data to `/tmp/data/issue_resolution.csv` with columns: `date,avg_days,median_days` |
| 70 | + |
| 71 | +Generate a line chart with moving average overlay: |
| 72 | +- Average time to close (7-day moving average line) |
| 73 | +- Median time to close |
| 74 | +- Shaded variance band |
| 75 | +- X-axis: last 30 days, Y-axis: days to resolution |
| 76 | +- Save as `/tmp/charts/issue_resolution_trends.png` at 300 DPI, 12×7 inches |
| 77 | + |
| 78 | +Run your Python scripts via bash and verify the charts exist before proceeding. |
| 79 | + |
| 80 | +### Python Notes |
| 81 | + |
| 82 | +- Use pandas for data manipulation and datetime handling |
| 83 | +- Use `matplotlib.pyplot` and `seaborn` for visualization |
| 84 | +- Apply `plt.tight_layout()` before saving |
| 85 | +- Handle sparse data gracefully (use bar charts if fewer than 7 data points) |
| 86 | +- Set `matplotlib.use('Agg')` to avoid display errors in headless environments |
| 87 | + |
| 88 | +## Step 3: Upload Charts |
| 89 | + |
| 90 | +Upload both chart images using the `upload-asset` safe output tool. Collect the returned URLs to embed in the discussion. |
| 91 | + |
| 92 | +## Step 4: Create Weekly Discussion |
| 93 | + |
| 94 | +Create a discussion with the title format: `Weekly Summary - [YYYY-MM-DD]` |
| 95 | + |
| 96 | +### Formatting Guidelines |
| 97 | + |
| 98 | +- Use `###` for main sections, `####` for subsections (discussion title is the h1) |
| 99 | +- Wrap long lists in `<details><summary>` collapsible sections |
| 100 | +- Keep critical information (overview, trends, statistics, recommendations) always visible |
| 101 | +- Keep optional detail (full issue lists, verbose breakdowns) in collapsible sections |
| 102 | + |
| 103 | +### Discussion Structure |
| 104 | + |
| 105 | +```markdown |
| 106 | +### 📊 Weekly Overview |
| 107 | + |
| 108 | +[1–2 paragraphs: total issues opened and closed this week, how that compares to the previous week, key theme or pattern in the issues] |
| 109 | + |
| 110 | +### 📈 Issue Activity Trends |
| 111 | + |
| 112 | +#### Weekly Activity Patterns |
| 113 | + |
| 114 | + |
| 115 | +[2–3 sentences: describe the trend — are issues accumulating, being resolved quickly, or holding steady?] |
| 116 | + |
| 117 | +#### Resolution Time Analysis |
| 118 | + |
| 119 | + |
| 120 | +[2–3 sentences: how quickly are issues being resolved? improving or slowing down?] |
| 121 | + |
| 122 | +### 🔑 Key Trends |
| 123 | + |
| 124 | +[Bullet list of 3–5 notable patterns: common issue types, label distribution, new contributors filing issues, recurring topics, etc.] |
| 125 | + |
| 126 | +### 📋 Summary Statistics |
| 127 | + |
| 128 | +| Metric | This Week | Last Week | Trend | |
| 129 | +|--------|-----------|-----------|-------| |
| 130 | +| Issues Opened | X | X | ↑/↓/→ | |
| 131 | +| Issues Closed | X | X | ↑/↓/→ | |
| 132 | +| Currently Open | X | X | ↑/↓/→ | |
| 133 | +| Avg Close Time | X days | X days | ↑/↓/→ | |
| 134 | + |
| 135 | +<details> |
| 136 | +<summary><b>Full Issue List (This Week)</b></summary> |
| 137 | + |
| 138 | +[Numbered list of all issues opened this week with title, number, author, labels] |
| 139 | + |
| 140 | +</details> |
| 141 | + |
| 142 | +### 💡 Recommendations for Upcoming Week |
| 143 | + |
| 144 | +[3–5 actionable suggestions: which issues to prioritize, patterns that suggest backlog growth, labels that need attention, etc.] |
| 145 | +``` |
| 146 | + |
| 147 | +## Step 5: Notes |
| 148 | + |
| 149 | +- If fewer than 7 days of data are available, generate charts with available data and note the limited range |
| 150 | +- If no issues exist this week, still create a discussion noting the quiet week |
| 151 | +- Always create the discussion even if charts fail to generate (omit chart sections and explain) |
0 commit comments