-
Notifications
You must be signed in to change notification settings - Fork 2
177 lines (149 loc) · 5.98 KB
/
Copy pathwave-tracking.yml
File metadata and controls
177 lines (149 loc) · 5.98 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Wave Progress Tracking
on:
issues:
types: [opened, edited, labeled, unlabeled]
issue_comment:
types: [created, edited]
pull_request:
types: [opened, ready_for_review, closed]
jobs:
track-wave-progress:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: read
steps:
- name: Check PR for Wave Label
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const pr = github.context.payload.pull_request;
const { owner, repo } = github.context.repo;
// Extract issue number from PR body (e.g., "Closes #212")
const issueMatch = pr.body?.match(/#(\d+)/);
if (!issueMatch) return;
const issueNumber = issueMatch[1];
const issue = await github.rest.issues.get({
owner, repo,
issue_number: issueNumber
});
// Copy wave and agent labels from issue to PR
const waveLabel = issue.data.labels.find(l => l.name.startsWith('wave:'));
const agentLabel = issue.data.labels.find(l => l.name.startsWith('agent:'));
if (waveLabel || agentLabel) {
const labels = [];
if (waveLabel) labels.push(waveLabel.name);
if (agentLabel) labels.push(agentLabel.name);
labels.push('pr-auto-labeled');
await github.rest.issues.addLabels({
owner, repo,
issue_number: pr.number,
labels
});
console.log(`✅ PR #${pr.number} labeled: ${labels.join(', ')}`);
}
auto-label-ready-for-testing:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add ready-for-testing label when PR merged
if: github.event.pull_request.merged == true
uses: actions/github-script@v7
with:
script: |
const pr = github.context.payload.pull_request;
const { owner, repo } = github.context.repo;
// Find linked issue
const issueMatch = pr.body?.match(/#(\d+)/);
if (!issueMatch) return;
const issueNumber = issueMatch[1];
// Add ready-for-testing label
await github.rest.issues.addLabels({
owner, repo,
issue_number: issueNumber,
labels: ['ready-for-testing', 'status:in-review']
});
// Post comment
await github.rest.issues.createComment({
owner, repo,
issue_number: issueNumber,
body: `🔄 **PR merged!** Issue now ready for testing. \`@agent:validator\` please begin validation. \n\nLink: ${pr.html_url}`
});
wave-status-report:
runs-on: ubuntu-latest
permissions:
issues: read
if: github.event_name == 'schedule' || contains(github.event.comment.body, '/wave-status')
steps:
- name: Generate Wave Status Report
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = github.context.repo;
// Find all open wave issues
const waves = await github.rest.issues.listForRepo({
owner, repo,
labels: 'agent:architect',
state: 'open',
per_page: 10
});
// For each wave, count issues
const waveData = {};
for (const wave of waves.data) {
if (!wave.title.startsWith('Wave')) continue;
const waveNum = wave.title.match(/Wave (\d+)/)?.[1];
if (!waveNum) continue;
// Count linked issues with body content
const issueMatches = (wave.body || '').match(/#(\d+)/g) || [];
const issueCount = issueMatches.length;
waveData[waveNum] = {
number: wave.number,
title: wave.title,
issues: issueCount,
state: wave.state
};
}
const report = Object.entries(waveData)
.map(([num, data]) => `- **Wave ${num}**: ${data.title} (${data.issues} issues)`)
.join('\n');
console.log('📊 Wave Status:\n' + report);
notify-wave-completion:
runs-on: ubuntu-latest
permissions:
issues: write
if: github.event.pull_request.merged == true
steps:
- name: Check if all wave issues done
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = github.context.repo;
// Find current wave (open wave issue with earliest creation)
const waves = await github.rest.issues.listForRepo({
owner, repo,
labels: 'agent:architect',
state: 'open'
});
const currentWave = waves.data.find(w => w.title.includes('Wave'));
if (!currentWave) return;
// Extract issue numbers from wave body
const issueMatches = (currentWave.body || '').match(/#(\d+)/g) || [];
if (issueMatches.length === 0) return;
// Check if all issues are closed
let allClosed = true;
for (const match of issueMatches) {
const issueNum = match.slice(1);
const issue = await github.rest.issues.get({
owner, repo,
issue_number: issueNum
});
if (issue.data.state !== 'closed') {
allClosed = false;
break;
}
}
if (allClosed) {
console.log(`✅ All issues in Wave ${currentWave.number} are closed!`);
}