Skip to content

Commit

Permalink
Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Jul 5, 2024
1 parent b96902e commit d799d80
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
13 changes: 11 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45839,7 +45839,16 @@ function createSummary(inputs, steps, moduleNames) {
// If push or archive is enabled add a link to the registry.
//if (inputs.push) table.push(["push", message(steps.push?.status)]);
//if (inputs.archive) table.push(["archive", message(steps.archive?.status)]);
return core.summary.addTable(table);
const output = core.summary.addTable(table);
if (inputs.push && moduleNames.length > 0) {
const modules = moduleNames.map((moduleName) => `<a href="https://${moduleName.name}">${moduleName.name}</a>`);
output.addRaw(`Pushed ${modules.join(", ")} to registry.`, true);
}
if (inputs.archive && moduleNames.length > 0) {
const modules = moduleNames.map((moduleName) => `<a href="https://${moduleName.name}">${moduleName.name}</a>`);
output.addRaw(`Archived ${modules.join(", ")} with ${inputs.archive_labels.join(", ")} labels.`, true);
}
return output;
}
// runWorkflow runs the buf workflow. It returns the results of each step.
// First, it builds the input. If the build fails, the workflow stops.
Expand Down Expand Up @@ -45944,7 +45953,7 @@ async function format(bufPath, inputs) {
const diff = parse_diff(result.stdout);
result.stdout = ""; // Clear the stdout to count the number of changes.
for (const file of diff) {
result.stdout += `::error file=${file.to},title=Buf format::Diff -${file.deletions}/+${file.additions}.\n`;
result.stdout += `::error file=${file.to}::Format diff -${file.deletions}/+${file.additions}.\n`;
}
console.log(result.stdout);
}
Expand Down
22 changes: 20 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,25 @@ function createSummary(
// If push or archive is enabled add a link to the registry.
//if (inputs.push) table.push(["push", message(steps.push?.status)]);
//if (inputs.archive) table.push(["archive", message(steps.archive?.status)]);
return core.summary.addTable(table);
const output = core.summary.addTable(table);
if (inputs.push && moduleNames.length > 0) {
const modules = moduleNames.map(
(moduleName) =>
`<a href="https://${moduleName.name}">${moduleName.name}</a>`,
);
output.addRaw(`Pushed ${modules.join(", ")} to registry.`, true);
}
if (inputs.archive && moduleNames.length > 0) {
const modules = moduleNames.map(
(moduleName) =>
`<a href="https://${moduleName.name}">${moduleName.name}</a>`,
);
output.addRaw(
`Archived ${modules.join(", ")} with ${inputs.archive_labels.join(", ")} labels.`,
true,
);
}
return output;
}

// runWorkflow runs the buf workflow. It returns the results of each step.
Expand Down Expand Up @@ -234,7 +252,7 @@ async function format(bufPath: string, inputs: Inputs): Promise<Result> {
const diff = parseDiff(result.stdout);
result.stdout = ""; // Clear the stdout to count the number of changes.
for (const file of diff) {
result.stdout += `::error file=${file.to},title=Buf format::Diff -${file.deletions}/+${file.additions}.\n`;
result.stdout += `::error file=${file.to}::Format diff -${file.deletions}/+${file.additions}.\n`;
}
console.log(result.stdout);
}
Expand Down

0 comments on commit d799d80

Please sign in to comment.