1
---
2
name: 'OSPO Organization Health Report'
3
description: 'Comprehensive weekly health report for a GitHub organization. Surfaces stale issues/PRs, merge time analysis, contributor leaderboards, and actionable items needing human attention.'
4
labels: ['ospo', 'reporting', 'org-health']
5
on:
6
schedule:
7
- cron: "0 10 * * 1"
8
workflow_dispatch:
9
inputs:
10
organization:
11
description: "GitHub organization to report on"
12
type: string
13
required: true
14
15
permissions:
16
contents: read
17
issues: read
18
pull-requests: read
19
actions: read
20
21
engine: copilot
22
23
tools:
24
github:
25
toolsets:
26
- repos
27
- issues
28
- pull_requests
29
- orgs
30
bash: true
31
32
safe-outputs:
33
create-issue:
34
max: 1
35
title-prefix: "[Org Health] "
36
37
timeout-minutes: 60
38
39
network:
40
allowed:
41
- defaults
42
- python
43
---
44
45
You are an expert GitHub organization analyst. Your job is to produce a
46
comprehensive weekly health report for your GitHub organization
47
(provided via workflow input).
48
49
## Primary Goal
50
51
**Surface issues and PRs that need human attention**, celebrate wins, and
52
provide actionable metrics so maintainers can prioritize their time.
53
54
---
55
56
## Step 1 — Determine the Organization
57
58
```
59
ORG = inputs.organization OR "my-org"
60
PERIOD_DAYS = 30
61
SINCE = date 30 days ago (ISO 8601)
62
STALE_ISSUE_DAYS = 60
63
STALE_PR_DAYS = 30
64
60_DAYS_AGO = date 60 days ago (ISO 8601)
65
30_DAYS_AGO = date 30 days ago (ISO 8601, same as SINCE)
66
```
67
68
## Step 2 — Gather Organization-Wide Aggregates (Search API)
69
70
Use GitHub search APIs for fast org-wide counts. These are efficient and
71
avoid per-repo iteration for basic aggregates.
72
73
Collect the following using search queries:
74
75
| Metric | Search Query |
76
|--------|-------------|
77
| Total open issues | `org:<ORG> is:issue is:open` |
78
| Total open PRs | `org:<ORG> is:pr is:open` |
79
| Issues opened (last 30d) | `org:<ORG> is:issue created:>={SINCE}` |
80
| Issues closed (last 30d) | `org:<ORG> is:issue is:closed closed:>={SINCE}` |
81
| PRs opened (last 30d) | `org:<ORG> is:pr created:>={SINCE}` |
82
| PRs merged (last 30d) | `org:<ORG> is:pr is:merged merged:>={SINCE}` |
83
| PRs closed unmerged (last 30d) | `org:<ORG> is:pr is:closed is:unmerged closed:>={SINCE}` |
84
| Stale issues (60+ days) | `org:<ORG> is:issue is:open updated:<={60_DAYS_AGO}` |
85
| Stale PRs (30+ days) | `org:<ORG> is:pr is:open updated:<={30_DAYS_AGO}` |
86
87
**Performance tip:** Add 1–2 second delays between search API calls to
88
stay well within rate limits.
89
90
## Step 3 — Stale Issues & PRs (Heat Scores)
91
92
For stale issues and stale PRs found above, retrieve the top results and
93
sort them by **heat score** (comment count). The heat score helps
94
maintainers prioritize: a stale issue with many comments signals community
95
interest that is going unaddressed.
96
97
- **Stale issues**: Retrieve up to 50, sort by `comments` descending,
98
keep top 10. For each, record: repo, number, title, days since last
99
update, comment count (heat score), author, labels.
100
- **Stale PRs**: Same approach — retrieve up to 50, sort by `comments`
101
descending, keep top 10.
102
103
## Step 4 — PR Merge Time Analysis
104
105
From the PRs merged in the last 30 days (Step 2), retrieve a sample of
106
recently merged PRs (up to 100). For each, calculate:
107
108
```
109
merge_time = merged_at - created_at (in hours)
110
```
111
112
Then compute percentiles:
113
- **p50** (median merge time)
114
- **p75**
115
- **p95**
116
117
Use bash with Python for percentile calculations:
118
119
```bash
120
python3 -c "
121
import json, sys
122
times = json.loads(sys.stdin.read())
123
times.sort()
124
n = len(times)
125
if n == 0:
126
print('No data')
127
else:
128
p50 = times[int(n * 0.50)]
129
p75 = times[int(n * 0.75)]
130
p95 = times[int(n * 0.95)] if n >= 20 else times[-1]
131
print(f'p50={p50:.1f}h, p75={p75:.1f}h, p95={p95:.1f}h')
132
"
133
```
134
135
## Step 5 — First Response Time
136
137
For issues and PRs opened in the last 30 days, sample up to 50 of each.
138
For each item, find the first comment (excluding the author). Calculate:
139
140
```
141
first_response_time = first_comment.created_at - item.created_at (in hours)
142
```
143
144
Report median first response time for issues and PRs separately.
145
146
## Step 6 — Repository Activity & Contributor Leaderboard
147
148
### Top 10 Active Repos
149
List all non-archived repos in the org. For each, count pushes / commits /
150
issues+PRs opened in the last 30 days. Sort by total activity, keep top 10.
151
152
### Contributor Leaderboard
153
From the top 10 active repos, aggregate commit authors over the last 30
154
days. Rank by commit count, keep top 10. Award:
155
- 🥇 for #1
156
- 🥈 for #2
157
- 🥉 for #3
158
159
### Inactive Repos
160
Repos with 0 pushes, 0 issues, 0 PRs in the last 30 days. List them
161
(name + last push date) so the org can decide whether to archive.
162
163
## Step 7 — Health Alerts & Trends
164
165
Compute velocity indicators and assign status:
166
167
| Indicator | 🟢 Green | 🟡 Yellow | 🔴 Red |
168
|-----------|----------|-----------|--------|
169
| Issue close rate | closed ≥ opened | closed ≥ 70% opened | closed < 70% opened |
170
| PR merge rate | merged ≥ opened | merged ≥ 60% opened | merged < 60% opened |
171
| Median merge time | < 24h | 24–72h | > 72h |
172
| Median first response | < 24h | 24–72h | > 72h |
173
| Stale issue count | < 10 | 10–50 | > 50 |
174
| Stale PR count | < 5 | 5–20 | > 20 |
175
176
## Step 8 — Wins & Shoutouts
177
178
Celebrate positive signals:
179
- PRs merged with fast turnaround (< 4 hours)
180
- Issues closed quickly (< 24 hours from open to close)
181
- Top contributors (from leaderboard)
182
- Repos with zero stale items
183
184
## Step 9 — Compose the Report
185
186
Create a single issue in the org's `.github` repository (or the most
187
appropriate central repo) with the title:
188
189
```
190
[Org Health] Weekly Report — <DATE>
191
```
192
193
The issue body should include these sections in order:
194
195
1. **Header** — org name, period, generation date
196
2. **🚨 Health Alerts** — table of indicators with 🟢/🟡/🔴 status and values
197
3. **🏆 Wins & Shoutouts** — fast merges, quick closes, top contributors
198
4. **📋 Stale Issues** — top 10 by heat score (repo, issue, days stale, comment count, labels)
199
5. **📋 Stale PRs** — top 10 by heat score (repo, PR, days stale, comment count, author)
200
6. **⏱️ PR Merge Time** — p50, p75, p95 percentiles
201
7. **⚡ First Response Time** — median for issues and PRs
202
8. **📊 Top 10 Active Repos** — sorted by total activity (issues + PRs + commits)
203
9. **👥 Contributor Leaderboard** — top 10 by commits with 🥇🥈🥉
204
10. **😴 Inactive Repos** — repos with 0 activity in 30 days
205
206
Use markdown tables for all data sections.
207
208
## Important Notes
209
210
- **Update the organization name** in the frontmatter before use.
211
- If any API call fails, note it in the report and continue with available
212
data. Do not let a single failure block the entire report.
213
- Keep the issue body under 65,000 characters (GitHub issue body limit).
214
- All times should be reported in hours. Convert to days only if > 72 hours.
215
- Use the `safe-outputs` constraint: only create 1 issue, with title
216
prefixed `[Org Health] `.
217