Skip to content

Commit 57c2f4e

Browse files
committed
Add error handling
1 parent ba32426 commit 57c2f4e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

.github/actions/release.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,18 @@ async function run() {
6262

6363
const octokit = github.getOctokit(token)
6464

65-
const remoteRelease = await octokit.rest.repos.getLatestRelease({
66-
owner: 'Gitification-App',
67-
repo: 'gitification',
68-
})
69-
70-
if (remoteRelease.data.name === packageJSON.version.toString()) {
71-
console.log('No version change detected, skipping build.')
72-
return
65+
try {
66+
const remoteRelease = await octokit.rest.repos.getLatestRelease({
67+
owner: 'Gitification-App',
68+
repo: 'gitification',
69+
})
70+
71+
if (remoteRelease.data.name === packageJSON.version.toString()) {
72+
console.log('No version change detected, skipping build.')
73+
return
74+
}
7375
}
76+
catch { /* If endpoint throws, it means no release yet */ }
7477

7578
const release = await octokit.rest.repos.createRelease({
7679
owner: 'Gitification-App',

0 commit comments

Comments
 (0)