From 1c1fb1a97f6aa51ab0d3097a6a0e1506012f7d48 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Thu, 22 Aug 2024 15:17:28 +0900 Subject: [PATCH 1/4] chore: fix display --- src/handlers/summary.ts | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/handlers/summary.ts b/src/handlers/summary.ts index f8cc5e43..7ac9d1d0 100644 --- a/src/handlers/summary.ts +++ b/src/handlers/summary.ts @@ -7,18 +7,29 @@ export interface ResultInfo { } function generateGitHubSummary(context: Context, urls: ResultInfo[]): string { - let output = "## Repositories\n\n"; - output += `Monitored: [${context.config.repos.monitor.join(" | ")}]\n\n`; - output += `Ignored: [${context.config.repos.ignore.join(" | ")}]\n\n`; - output += "## Merging\n\n"; - output += "šŸŸ¢: merged\nšŸ”µ: no change\n\n"; - output += urls - .map(({ url, merged }) => { - const status = merged ? `šŸŸ¢` : `šŸ”µ`; - return `- ${status} - [${url}](${url})`; - }) - .join("\n"); - return output; + const target = `https://github.com/${context.payload.repository.owner?.login}`; + const output: string[] = ["## Merge report\n\n"]; + output.push(""); + output.push("| Merged | ID |\n"); + output.push("|---|---|\n"); + output.push( + urls + .sort((a) => (a.merged ? -1 : 1)) + .map(({ url, merged }) => { + const status = merged ? `šŸ”µ` : `āš«ļø`; + return `| ${status} | [${url.split("/").pop()}](${url}) |`; + }) + .join("\n") + ); + output.push(""); + output.push("šŸ”µ= merged"); + output.push("āš«ļø= unmerged"); + output.push("## Configuration\n\n"); + output.push("### Watching Repositories\n\n"); + output.push(context.config.repos.monitor.map((o) => `- [${o}](${target}/${o})`).join("\n")); + output.push("### Ignored Repositories\n\n"); + output.push(context.config.repos.ignore.map((o) => `- [${o}](${target}/${o})`).join("\n")); + return output.join("\n"); } export async function generateSummary(context: Context, results: ResultInfo[]) { From 1b0695714ea07e4ba8c9c8093cc47ced2995de9c Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Thu, 22 Aug 2024 15:25:43 +0900 Subject: [PATCH 2/4] chore: fix display --- src/handlers/summary.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/handlers/summary.ts b/src/handlers/summary.ts index 7ac9d1d0..513dcab0 100644 --- a/src/handlers/summary.ts +++ b/src/handlers/summary.ts @@ -1,4 +1,5 @@ import * as core from "@actions/core"; +import { parseGitHubUrl } from "../helpers/github"; import { Context } from "../types"; export interface ResultInfo { @@ -9,21 +10,22 @@ export interface ResultInfo { function generateGitHubSummary(context: Context, urls: ResultInfo[]): string { const target = `https://github.com/${context.payload.repository.owner?.login}`; const output: string[] = ["## Merge report\n\n"]; - output.push(""); - output.push("| Merged | ID |\n"); - output.push("|---|---|\n"); + output.push("\n"); + output.push("| Merged | ID |"); + output.push("|---|---|"); output.push( urls .sort((a) => (a.merged ? -1 : 1)) .map(({ url, merged }) => { const status = merged ? `šŸ”µ` : `āš«ļø`; - return `| ${status} | [${url.split("/").pop()}](${url}) |`; + const { repo, issue_number } = parseGitHubUrl(url); + return `| ${status} | [${repo}#${issue_number}](${url}) |`; }) .join("\n") ); - output.push(""); - output.push("šŸ”µ= merged"); - output.push("āš«ļø= unmerged"); + output.push("\n\n"); + output.push("šŸ”µ = merged"); + output.push("āš«ļø = unmerged"); output.push("## Configuration\n\n"); output.push("### Watching Repositories\n\n"); output.push(context.config.repos.monitor.map((o) => `- [${o}](${target}/${o})`).join("\n")); From 2d153856c2d28686a9ad675a113c4f31fc6a757f Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Thu, 22 Aug 2024 15:28:25 +0900 Subject: [PATCH 3/4] chore: fix display --- src/handlers/summary.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/handlers/summary.ts b/src/handlers/summary.ts index 513dcab0..720102af 100644 --- a/src/handlers/summary.ts +++ b/src/handlers/summary.ts @@ -23,9 +23,9 @@ function generateGitHubSummary(context: Context, urls: ResultInfo[]): string { }) .join("\n") ); - output.push("\n\n"); output.push("šŸ”µ = merged"); output.push("āš«ļø = unmerged"); + output.push("\n\n"); output.push("## Configuration\n\n"); output.push("### Watching Repositories\n\n"); output.push(context.config.repos.monitor.map((o) => `- [${o}](${target}/${o})`).join("\n")); From a58485a5297c563fdecd9be6a2d4521668f12d91 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Thu, 22 Aug 2024 15:32:17 +0900 Subject: [PATCH 4/4] chore: fix display --- src/handlers/summary.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/handlers/summary.ts b/src/handlers/summary.ts index 720102af..3f91a628 100644 --- a/src/handlers/summary.ts +++ b/src/handlers/summary.ts @@ -23,6 +23,7 @@ function generateGitHubSummary(context: Context, urls: ResultInfo[]): string { }) .join("\n") ); + output.push("\n"); output.push("šŸ”µ = merged"); output.push("āš«ļø = unmerged"); output.push("\n\n");