Skip to content

Commit 03e9e23

Browse files
chore: shows up an appropriate message in case no events were found
1 parent bee498c commit 03e9e23

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

dist/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,11 @@ const commitFile = async () => {
15451545
]);
15461546
await exec("git", ["config", "--global", "user.name", "readme-bot"]);
15471547
await exec("git", ["add", "README.md"]);
1548-
await exec("git", ["commit", "-m", ":zap: update readme with the recent activity"]);
1548+
await exec("git", [
1549+
"commit",
1550+
"-m",
1551+
":zap: update readme with the recent activity",
1552+
]);
15491553
await exec("git", ["push"]);
15501554
};
15511555

@@ -1610,6 +1614,14 @@ Toolkit.run(
16101614
(content) => content.trim() === "<!--END_SECTION:activity-->"
16111615
);
16121616

1617+
if (!content.length) {
1618+
tools.exit.failure("No events found");
1619+
}
1620+
1621+
if (content.length < 5) {
1622+
tools.log.info("Found less than 5 activities");
1623+
}
1624+
16131625
if (startIdx !== -1 && endIdx === -1) {
16141626
// Add one since the content needs to be inserted just after the initial comment
16151627
startIdx++;

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ Toolkit.run(
139139
(content) => content.trim() === "<!--END_SECTION:activity-->"
140140
);
141141

142+
if (!content.length) {
143+
tools.exit.failure("No events found");
144+
}
145+
146+
if (content.length < 5) {
147+
tools.log.info("Found less than 5 activities");
148+
}
149+
142150
if (startIdx !== -1 && endIdx === -1) {
143151
// Add one since the content needs to be inserted just after the initial comment
144152
startIdx++;

0 commit comments

Comments
 (0)