forked from HKUDS/OpenSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (76 loc) · 3.31 KB
/
Copy pathprogress-dashboard.yml
File metadata and controls
89 lines (76 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Progress Dashboard
on:
schedule:
- cron: '0 8 * * 1,4' # Monday & Thursday at 8 AM UTC
workflow_dispatch:
jobs:
dashboard:
runs-on: ubuntu-latest
steps:
- name: Generate progress report
uses: actions/github-script@v7
with:
script: |
const milestones = await github.rest.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
sort: 'created',
direction: 'asc'
});
let totalOpen = 0, totalClosed = 0;
let phaseLines = [];
for (const ms of milestones.data) {
const total = ms.open_issues + ms.closed_issues;
if (total === 0) continue;
const pct = Math.round((ms.closed_issues / total) * 100);
totalOpen += ms.open_issues;
totalClosed += ms.closed_issues;
const bar = '█'.repeat(Math.floor(pct / 5)) + '░'.repeat(20 - Math.floor(pct / 5));
const status = ms.open_issues === 0 ? '✅ DONE' : `⏳ ${ms.open_issues} left`;
phaseLines.push(`| ${ms.title} | ${bar} ${pct}% | ${ms.closed_issues}/${total} | ${status} |`);
}
const grandTotal = totalOpen + totalClosed;
const overallPct = grandTotal > 0 ? Math.round((totalClosed / grandTotal) * 100) : 0;
const overallBar = '█'.repeat(Math.floor(overallPct / 5)) + '░'.repeat(20 - Math.floor(overallPct / 5));
const report = `# 📊 OpenSpace Upgrade — Progress Dashboard
> Auto-generated: ${new Date().toISOString().split('T')[0]} | [View Project Board](https://github.com/Deepfreezechill/OpenSpace/projects)
## Overall: ${overallPct}% Complete
\`\`\`
${overallBar} ${overallPct}% (${totalClosed}/${grandTotal} tasks)
\`\`\`
## Phase Breakdown
| Phase | Progress | Done/Total | Status |
|-------|----------|------------|--------|
${phaseLines.join('\n')}
## Velocity
- **This week:** Check [closed issues](https://github.com/${context.repo.owner}/${context.repo.repo}/issues?q=is%3Aclosed+sort%3Aupdated-desc)
- **Target:** ~12-15 tasks/week for 6-month completion
---
*Updated automatically Mon & Thu. Run manually: Actions → Progress Dashboard → Run workflow*`;
// Find or create the dashboard issue
const existing = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'dashboard',
state: 'open'
});
if (existing.data.length > 0) {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existing.data[0].number,
body: report
});
console.log(`Updated dashboard issue #${existing.data[0].number}`);
} else {
const created = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '📊 Project Progress Dashboard',
body: report,
labels: ['dashboard']
});
// Pin it
console.log(`Created dashboard issue #${created.data.number}`);
}