@ravshansbox/pi-next-issue 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/github.ts +16 -7
package/package.json
CHANGED
package/src/github.ts
CHANGED
|
@@ -227,15 +227,24 @@ export async function failedLogs(repo: Repo, pr: number, maxChars: number): Prom
|
|
|
227
227
|
const failed = (await readChecks(repo, pr)).filter(
|
|
228
228
|
(check) => check.bucket === 'fail' || check.bucket === 'cancel',
|
|
229
229
|
);
|
|
230
|
-
const
|
|
231
|
-
const parts: string[] = [];
|
|
230
|
+
const groups = new Map<string, { names: string[]; runId: string | undefined }>();
|
|
232
231
|
for (const check of failed) {
|
|
233
|
-
parts.push(`## ${check.name}`);
|
|
234
232
|
const runId = /\/actions\/runs\/(\d+)/.exec(check.link)?.[1];
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
const key = runId ?? `check:${check.name}`;
|
|
234
|
+
const group = groups.get(key) ?? { names: [], runId };
|
|
235
|
+
group.names.push(check.name);
|
|
236
|
+
groups.set(key, group);
|
|
237
|
+
}
|
|
238
|
+
const share = Math.max(1, Math.floor(maxChars / Math.max(1, groups.size)));
|
|
239
|
+
const parts: string[] = [];
|
|
240
|
+
for (const group of groups.values()) {
|
|
241
|
+
parts.push(`## ${group.names.join(', ')}`);
|
|
242
|
+
if (group.runId !== undefined) {
|
|
243
|
+
const logs = await run(
|
|
244
|
+
'gh',
|
|
245
|
+
['run', 'view', group.runId, '--log-failed', '--repo', repo.slug],
|
|
246
|
+
{ cwd: repo.root },
|
|
247
|
+
);
|
|
239
248
|
parts.push((logs.stdout || logs.stderr).slice(-share));
|
|
240
249
|
}
|
|
241
250
|
}
|