Skip to content

Commit

Permalink
fix: do not report with empty issues
Browse files Browse the repository at this point in the history
  • Loading branch information
faergeek committed Nov 16, 2022
1 parent f4a8725 commit eebd131
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
24 changes: 16 additions & 8 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20000,8 +20000,12 @@ async function run() {
const url = `${hooksUrl}/${hookMerge}`;
const headers = { "Content-Type": "application/json" };
const body = JSON.stringify({ issues });
console.log(`\u2705 Reporting issues as merged: ${issues.join(", ")}`);
await http.post(url, body, headers);
if (issues.length === 0) {
console.log("No issues to report");
} else {
console.log(`\u2705 Reporting issues as merged: ${issues.join(", ")}`);
await http.post(url, body, headers);
}
break;
}
case "release": {
Expand All @@ -20016,12 +20020,16 @@ async function run() {
const url = `${hooksUrl}/${hookRelease}`;
const headers = { "Content-Type": "application/json" };
const body = JSON.stringify({ component, issues, releaseVersion });
console.log(
`\u{1F680} Reporting issues as released in ${component} ${releaseVersion}: ${issues.join(
", "
)}`
);
await http.post(url, body, headers);
if (issues.length === 0) {
console.log("No issues to report");
} else {
console.log(
`\u{1F680} Reporting issues as released in ${component} ${releaseVersion}: ${issues.join(
", "
)}`
);
await http.post(url, body, headers);
}
break;
}
default:
Expand Down
32 changes: 21 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ async function run() {
const headers = { 'Content-Type': 'application/json' };
const body = JSON.stringify({ issues });

// eslint-disable-next-line no-console
console.log(`✅ Reporting issues as merged: ${issues.join(', ')}`);
await http.post(url, body, headers);
if (issues.length === 0) {
// eslint-disable-next-line no-console
console.log('No issues to report');
} else {
// eslint-disable-next-line no-console
console.log(`✅ Reporting issues as merged: ${issues.join(', ')}`);
await http.post(url, body, headers);
}
break;
}
case 'release': {
Expand All @@ -82,14 +87,19 @@ async function run() {
const headers = { 'Content-Type': 'application/json' };
const body = JSON.stringify({ component, issues, releaseVersion });

// eslint-disable-next-line no-console
console.log(
`🚀 Reporting issues as released in ${component} ${releaseVersion}: ${issues.join(
', '
)}`
);

await http.post(url, body, headers);
if (issues.length === 0) {
// eslint-disable-next-line no-console
console.log('No issues to report');
} else {
// eslint-disable-next-line no-console
console.log(
`🚀 Reporting issues as released in ${component} ${releaseVersion}: ${issues.join(
', '
)}`
);

await http.post(url, body, headers);
}
break;
}
default:
Expand Down

0 comments on commit eebd131

Please sign in to comment.