Skip to content

Commit

Permalink
Revert layout change
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Jul 8, 2024
1 parent 1791013 commit f1c0fa9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 36 deletions.
31 changes: 13 additions & 18 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45752,7 +45752,10 @@ async function main() {
// Comment on the PR with the summary, if requested.
if (inputs.pr_comment) {
const commentID = await findCommentOnPR(lib_github.context, github);
await commentOnPR(lib_github.context, github, commentID, `The latest Buf updates on your PR.\n\n${summary.stringify()}`);
await commentOnPR(lib_github.context, github, commentID, `The latest Buf updates on your PR. ${linkToRun("View")} the run, last updated ${new Date().toLocaleString("en-US", {
timeZone: "UTC",
hour12: true,
})}.\n\n${summary.stringify()}`);
}
// Write the summary to a file defined by GITHUB_STEP_SUMMARY.
// NB: Write empties the buffer and must be after the comment.
Expand All @@ -45772,24 +45775,13 @@ main()
function createSummary(inputs, steps, moduleNames) {
const table = [
[
{ data: "Build", header: true },
{ data: "Format", header: true },
{ data: "Lint", header: true },
{ data: "Breaking", header: true },
{ data: "Run", header: true },
{ data: "Updated (UTC)", header: true },
],
[
message(steps.build),
message(steps.format),
message(steps.lint),
message(steps.breaking),
`<a href="${lib_github.context.serverUrl}/${lib_github.context.repo.owner}/${lib_github.context.repo.repo}/actions/runs/${lib_github.context.runId}">view</a>`,
new Date().toLocaleString("en-US", {
timeZone: "UTC",
hour12: true,
}),
{ data: "Name", header: true },
{ data: "Status", header: true },
],
["build", message(steps.build)],
["lint", message(steps.lint)],
["format", message(steps.format)],
["breaking", message(steps.breaking)],
];
// If push or archive is enabled add a link to the registry.
let output = core.summary.addTable(table);
Expand Down Expand Up @@ -46073,6 +46065,9 @@ function message(result) {
return "<code>🚫 cancelled</code>";
}
}
function linkToRun(message) {
return `<a href="${lib_github.context.serverUrl}/${lib_github.context.repo.owner}/${lib_github.context.repo.repo}/actions/runs/${lib_github.context.runId}">${message}</a>`;
}

})();

Expand Down
35 changes: 17 additions & 18 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ async function main() {
context,
github,
commentID,
`The latest Buf updates on your PR.\n\n${summary.stringify()}`,
`The latest Buf updates on your PR. ${linkToRun("View")} the run, last updated ${new Date().toLocaleString(
"en-US",
{
timeZone: "UTC",
hour12: true,
},
)}.\n\n${summary.stringify()}`,
);
}
// Write the summary to a file defined by GITHUB_STEP_SUMMARY.
Expand Down Expand Up @@ -93,24 +99,13 @@ function createSummary(
): typeof core.summary {
const table = [
[
{ data: "Build", header: true },
{ data: "Format", header: true },
{ data: "Lint", header: true },
{ data: "Breaking", header: true },
{ data: "Run", header: true },
{ data: "Updated (UTC)", header: true },
],
[
message(steps.build),
message(steps.format),
message(steps.lint),
message(steps.breaking),
`<a href="${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}">view</a>`,
new Date().toLocaleString("en-US", {
timeZone: "UTC",
hour12: true,
}),
{ data: "Name", header: true },
{ data: "Status", header: true },
],
["build", message(steps.build)],
["lint", message(steps.lint)],
["format", message(steps.format)],
["breaking", message(steps.breaking)],
];
// If push or archive is enabled add a link to the registry.
let output = core.summary.addTable(table);
Expand Down Expand Up @@ -444,3 +439,7 @@ function message(result: Result | undefined): string {
return "<code>🚫 cancelled</code>";
}
}

function linkToRun(message: string): string {
return `<a href="${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}">${message}</a>`;
}

0 comments on commit f1c0fa9

Please sign in to comment.