Skip to content

Commit 5a59312

Browse files
authored
fix: abort when no review entries are found for period (#107)
1 parent b1825f0 commit 5a59312

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/__tests__/execute.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ describe('execute', () => {
141141
expect(github.getOctokit).toBeCalledWith(inputs.personalToken, { baseUrl: githubUrl });
142142
});
143143

144+
it('aborts execution when no entries are found', async () => {
145+
getEntries.mockResolvedValueOnce([]);
146+
const results = await execute(inputs);
147+
expect(results).toBeNull();
148+
expect(getEntries).toBeCalled();
149+
expect(publish).not.toBeCalled();
150+
});
151+
144152
describe('Sponsorship', () => {
145153
it('checks if the user is a sponsor', async () => {
146154
checkSponsorship.mockResolvedValueOnce(true);

src/execute.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const run = async ({ inputs, octokit }) => {
4040
});
4141
core.debug(`Analyzed entries: ${entries.length}`);
4242

43+
if (entries.length === 0) {
44+
core.info('No reviews found for the specified period.');
45+
return null;
46+
}
47+
4348
await publish({
4449
core,
4550
octokit,

0 commit comments

Comments
 (0)