Skip to content

Commit

Permalink
Merge pull request #36 from 108yen/feat/error-handling
Browse files Browse the repository at this point in the history
Added error handling
  • Loading branch information
108yen authored Oct 4, 2024
2 parents b819819 + b1fb03c commit 6898950
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-trees-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"changeset-release": patch
---

Added error handling for failed `createRelease` using `octokit`.
19 changes: 13 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,19 @@ async function main() {
const tagName = `v${version}`
const { content } = getChangelogEntry(changelog, version)

await octokit.rest.repos.createRelease({
body: content,
name: tagName,
tag_name: tagName,
...github.context.repo,
})
try {
await octokit.rest.repos.createRelease({
body: content,
name: tagName,
tag_name: tagName,
...github.context.repo,
})
} catch (error) {
core.error(error as string)
core.setFailed(
"Failed create release. Please make sure 'contents: write' permission is granted to job.",
)
}

core.setOutput("tag", tagName)
} catch (error) {
Expand Down

0 comments on commit 6898950

Please sign in to comment.