@@ -160,6 +160,27 @@ jobs:
160160 }
161161 }
162162
163+ const pickLastTwoSegments = (textOrUrl) => {
164+ if (!textOrUrl) return '';
165+ try {
166+ const urlObj = new URL(textOrUrl);
167+ const segs = urlObj.pathname.split('/').filter(Boolean);
168+ if (segs.length >= 2) return `${segs[segs.length - 2]}/${segs[segs.length - 1]}/`;
169+ if (segs.length === 1) return `${segs[0]}/`;
170+ return '';
171+ } catch {
172+ const m = (textOrUrl.match(/https?:\/\/[^\s)'"<>]+/i) || [])[0];
173+ if (!m) return '';
174+ try {
175+ const u = new URL(m);
176+ const segs = u.pathname.split('/').filter(Boolean);
177+ if (segs.length >= 2) return `${segs[segs.length - 2]}/${segs[segs.length - 1]}/`;
178+ if (segs.length === 1) return `${segs[0]}/`;
179+ return '';
180+ } catch { return ''; }
181+ }
182+ };
183+
163184 // Movement counters & log
164185 let movedDoneToMaint = 0;
165186 let movedMaintToDone = 0;
@@ -173,12 +194,18 @@ jobs:
173194 const status = getStatusName(item);
174195 const lrd = getDate(item, lrdId);
175196 if (!status || !lrd) continue; // only move when LRD exists
197+
198+ const prNumber = item.content.number;
199+ const repoName = item.content.repository.name;
200+ const shortRef = `${repoName}#${prNumber}`;
201+
202+ let lastTwoSegments = pickLastTwoSegments(item.content.bodyText) || pickLastTwoSegments(item.content.url) || '(no-path)';
176203
177204 // Done -> Maintenance: LRD older/equal than 6 months ago
178205 if (status === STATUS_DONE && toDate(lrd) <= toDate(sixMonthsAgoISO)) {
179206 await setStatus(itemId, statusFieldId, maintId);
180207 movedDoneToMaint++;
181- const line = `[Cron] Move Done → Maintenance (LRD ${lrd} ≤ ${sixMonthsAgoISO})`;
208+ const line = `[Cron] Moved ${shortRef} → Maintenance (LRD ${lrd} ≤ ${sixMonthsAgoISO}) | ${lastTwoSegments} `;
182209 console.log(line);
183210 moveLog.push(line);
184211 continue; // skip second rule for same item
@@ -188,7 +215,7 @@ jobs:
188215 if (status === STATUS_MAINT && toDate(lrd) > toDate(sixMonthsAgoISO)) {
189216 await setStatus(itemId, statusFieldId, doneId);
190217 movedMaintToDone++;
191- const line = `[Cron] Move Maintenance → Done (LRD ${lrd} > ${sixMonthsAgoISO})`;
218+ const line = `[Cron] Moved ${shortRef} → Done (LRD ${lrd} > ${sixMonthsAgoISO}) | ${lastTwoSegments} `;
192219 console.log(line);
193220 moveLog.push(line);
194221 }
@@ -209,4 +236,4 @@ jobs:
209236 ])
210237 .addHeading('Details', 2)
211238 .addCodeBlock(moveLog.join('\n') || 'No moves', 'text')
212- .write();
239+ .write();
0 commit comments