Skip to content

Commit 94f7259

Browse files
authored
Merge branch 'ArmDeveloperEcosystem:main' into main
2 parents bfbbfad + a80bb77 commit 94f7259

329 files changed

Lines changed: 13695 additions & 6641 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/last-reviewed-cron.yml

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ permissions:
1717

1818
jobs:
1919
sweep:
20+
if: github.repository == 'ArmDeveloperEcosystem/arm-learning-paths'
2021
runs-on: ubuntu-latest
2122
steps:
2223
- name: Move items based on Last Reviewed Date
@@ -34,6 +35,7 @@ jobs:
3435
const STATUS_DONE = 'Done';
3536
const STATUS_MAINT = 'Maintenance';
3637
const LRD_FIELD_NAME = 'Last Reviewed Date';
38+
const PUBLISHED_URL_FIELD_NAME = 'Published URL';
3739
// ----------------------------------
3840
3941
// Dates
@@ -77,12 +79,20 @@ jobs:
7779
const findDateFieldId = (name) =>
7880
fields.find(f => f.__typename === 'ProjectV2Field' && f.name === name && f.dataType === 'DATE')?.id || null;
7981
82+
const findTextFieldId = (name) => {
83+
const exact = fields.find(f => f.__typename === 'ProjectV2Field' && f.name === name && f.dataType === 'TEXT');
84+
if (exact) return exact.id;
85+
const ci = fields.find(f => f.__typename === 'ProjectV2Field' && (f.name?.toLowerCase?.() === name.toLowerCase()) && f.dataType === 'TEXT');
86+
return ci?.id || null;
87+
};
88+
8089
const statusField = fields.find(f => f.__typename === 'ProjectV2SingleSelectField' && f.name === STATUS_FIELD_NAME);
8190
const statusFieldId = statusField?.id || null;
8291
const doneId = statusField?.options?.find(o => o.name === STATUS_DONE)?.id || null;
8392
const maintId = statusField?.options?.find(o => o.name === STATUS_MAINT)?.id || null;
8493
8594
const lrdId = findDateFieldId(LRD_FIELD_NAME);
95+
const publishedUrlFieldId = findTextFieldId(PUBLISHED_URL_FIELD_NAME);
8696
8797
if (!statusFieldId || !doneId || !maintId || !lrdId) {
8898
throw new Error('Missing required project fields/options: Status/Done/Maintenance or Last Reviewed Date.');
@@ -94,6 +104,11 @@ jobs:
94104
n.__typename === 'ProjectV2ItemFieldDateValue' && n.field?.id === fieldId
95105
)?.date || null;
96106
107+
const getText = (item, fieldId) =>
108+
item.fieldValues.nodes.find(n =>
109+
n.__typename === 'ProjectV2ItemFieldTextValue' && n.field?.id === fieldId
110+
)?.text || null;
111+
97112
const getStatusName = (item) => {
98113
const n = item.fieldValues.nodes.find(n =>
99114
n.__typename === 'ProjectV2ItemFieldSingleSelectValue' && n.field?.id === statusFieldId
@@ -129,15 +144,22 @@ jobs:
129144
id
130145
content{
131146
__typename
132-
... on PullRequest { number repository{ name } }
147+
... on PullRequest {
148+
number
149+
repository { name }
150+
}
133151
}
134-
fieldValues(first:50){
152+
fieldValues(first:100){
135153
nodes{
136154
__typename
137155
... on ProjectV2ItemFieldDateValue {
138156
field { ... on ProjectV2Field { id name } }
139157
date
140158
}
159+
... on ProjectV2ItemFieldTextValue {
160+
field { ... on ProjectV2Field { id name } }
161+
text
162+
}
141163
... on ProjectV2ItemFieldSingleSelectValue {
142164
field { ... on ProjectV2SingleSelectField { id name } }
143165
name
@@ -146,20 +168,35 @@ jobs:
146168
}
147169
}
148170
}
149-
pageInfo{ hasNextPage endCursor }
171+
pageInfo {
172+
hasNextPage
173+
endCursor
174+
}
150175
}
151176
}
152177
}
153178
}`,
154179
{ org: orgLogin, num: projectNumber, after: cursor }
155180
);
181+
156182
const page = r.organization.projectV2.items;
157183
for (const n of page.nodes) yield n;
158184
if (!page.pageInfo.hasNextPage) break;
159185
cursor = page.pageInfo.endCursor;
160186
}
161187
}
162188
189+
const lastTwoFromUrl = (url) => {
190+
if (!url) return '';
191+
try {
192+
const u = new URL(url);
193+
const segs = u.pathname.split('/').filter(Boolean);
194+
if (segs.length >= 2) return `${segs[segs.length - 2]}/${segs[segs.length - 1]}/`;
195+
if (segs.length === 1) return `${segs[0]}/`;
196+
return '';
197+
} catch { return ''; }
198+
};
199+
163200
// Movement counters & log
164201
let movedDoneToMaint = 0;
165202
let movedMaintToDone = 0;
@@ -173,12 +210,18 @@ jobs:
173210
const status = getStatusName(item);
174211
const lrd = getDate(item, lrdId);
175212
if (!status || !lrd) continue; // only move when LRD exists
213+
214+
const prNumber = item.content.number;
215+
const repoName = item.content.repository.name;
216+
217+
const publishedUrl = publishedUrlFieldId ? getText(item, publishedUrlFieldId) : null;
218+
const lastTwoSegments = lastTwoFromUrl(publishedUrl) || '(no-published-url)';
176219
177220
// Done -> Maintenance: LRD older/equal than 6 months ago
178221
if (status === STATUS_DONE && toDate(lrd) <= toDate(sixMonthsAgoISO)) {
179222
await setStatus(itemId, statusFieldId, maintId);
180223
movedDoneToMaint++;
181-
const line = `[Cron] Move Done → Maintenance (LRD ${lrd} ≤ ${sixMonthsAgoISO})`;
224+
const line = `[Cron] Moved ${lastTwoSegments} → Maintenance (LRD ${lrd} ≤ ${sixMonthsAgoISO})`;
182225
console.log(line);
183226
moveLog.push(line);
184227
continue; // skip second rule for same item
@@ -188,7 +231,7 @@ jobs:
188231
if (status === STATUS_MAINT && toDate(lrd) > toDate(sixMonthsAgoISO)) {
189232
await setStatus(itemId, statusFieldId, doneId);
190233
movedMaintToDone++;
191-
const line = `[Cron] Move Maintenance → Done (LRD ${lrd} > ${sixMonthsAgoISO})`;
234+
const line = `[Cron] Moved ${lastTwoSegments} → Done (LRD ${lrd} > ${sixMonthsAgoISO})`;
192235
console.log(line);
193236
moveLog.push(line);
194237
}
@@ -209,4 +252,4 @@ jobs:
209252
])
210253
.addHeading('Details', 2)
211254
.addCodeBlock(moveLog.join('\n') || 'No moves', 'text')
212-
.write();
255+
.write();

.github/workflows/roadmap-update.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,23 @@ jobs:
171171
console.log('Start Date field not found');
172172
}
173173
} else if (labelName === 'publish') {
174-
const endDateFieldId = await getFieldId(projectId, 'Publish Date');
175-
if (endDateFieldId) {
176-
await updateDateField(projectId, itemId, endDateFieldId, today);
174+
// Publish Date
175+
const publishDateFieldId = await getFieldId(projectId, 'Publish Date');
176+
if (publishDateFieldId) {
177+
await updateDateField(projectId, itemId, publishDateFieldId, today);
177178
console.log('Updated Publish Date to', today);
178179
} else {
179180
console.log('Publish Date field not found');
180181
}
182+
183+
// Last Reviewed Date (same as Publish Date)
184+
const lastReviewedFieldId = await getFieldId(projectId, 'Last Reviewed Date');
185+
if (lastReviewedFieldId) {
186+
await updateDateField(projectId, itemId, lastReviewedFieldId, today);
187+
console.log('Updated Last Reviewed Date to', today);
188+
} else {
189+
console.log('Last Reviewed Date field not found');
190+
}
181191
} else {
182192
console.log('No action taken for label:', labelName);
183193
}
@@ -187,4 +197,4 @@ jobs:
187197
}
188198
}
189199
190-
main();
200+
main();

0 commit comments

Comments
 (0)