Throw explicit error if list releases reponse doesn't have data

This commit is contained in:
Nick Cipollo
2025-01-11 21:52:42 -05:00
parent e774b3eb81
commit 033b82b409
4 changed files with 35 additions and 2 deletions

3
dist/index.js vendored
View File

@@ -124,6 +124,9 @@ class Action {
const tag = this.inputs.tag;
const response = await this.releases.listReleases();
const releases = response.data;
if (!releases) {
throw new Error(`No releases found. Response: ${JSON.stringify(response)}`);
}
const draftRelease = releases.find(release => release.draft && release.tag_name == tag);
return draftRelease?.id;
}