Skip to content

Commit

Permalink
Merge pull request #1 from issue-ops/options
Browse files Browse the repository at this point in the history
Avoid adding options without defaults
  • Loading branch information
ncalteen authored Sep 26, 2023
2 parents b668877 + ecb6281 commit 8e6ecdd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
15 changes: 10 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "releaser",
"description": "Handle releases for GitHub repositories",
"version": "0.1.0",
"version": "0.1.1",
"author": "Nick Alteen <[email protected]>",
"homepage": "https://github.com/issue-ops/releaser#readme",
"repository": {
Expand Down
15 changes: 10 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,23 @@ export async function run(): Promise<void> {
const github: Octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })

try {
// Create the release
const response = await github.rest.repos.createRelease({
// Create the API options
const options: any = {
owner,
repo,
tag_name: tag,
target_commitish: target === '' ? undefined : target,
name,
body: notes === '' ? undefined : notes,
draft,
prerelease,
generate_release_notes: generateReleaseNotes
})
}

// Only add these options if they were provided
if (target !== '') options.target_commitish = target
if (notes !== '') options.body = notes

// Create the release
const response = await github.rest.repos.createRelease(options)

core.debug(`Response: ${JSON.stringify(response, null, 2)}`)

Expand Down

0 comments on commit 8e6ecdd

Please sign in to comment.