Skip to content

Commit cf6e2d4

Browse files
mydeaBYK
andauthored
fix(github): Guard against missing release (#567)
Co-authored-by: Burak Yigit Kaya <[email protected]> --------- Co-authored-by: Burak Yigit Kaya <[email protected]>
1 parent 26d1692 commit cf6e2d4

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/targets/github.ts

+15-4
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,21 @@ export class GitHubTarget extends BaseTarget {
127127
};
128128
}
129129

130-
const { data: latestRelease } = await this.github.repos.getLatestRelease({
131-
owner: this.githubConfig.owner,
132-
repo: this.githubConfig.repo,
133-
});
130+
let latestRelease: { tag_name: string } | undefined;
131+
try {
132+
latestRelease = (
133+
await this.github.repos.getLatestRelease({
134+
owner: this.githubConfig.owner,
135+
repo: this.githubConfig.repo,
136+
})
137+
).data;
138+
} catch (error) {
139+
// if the error is a 404 error, it means that no release exists yet
140+
// all other errors should be rethrown
141+
if (error.status !== 404) {
142+
throw error;
143+
}
144+
}
134145

135146
const isLatest = isPreview
136147
? false

0 commit comments

Comments
 (0)