Skip to content

Commit 8e6ecdd

Browse files
authored
Merge pull request #1 from issue-ops/options
Avoid adding options without defaults
2 parents b668877 + ecb6281 commit 8e6ecdd

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

dist/index.js

+10-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "releaser",
33
"description": "Handle releases for GitHub repositories",
4-
"version": "0.1.0",
4+
"version": "0.1.1",
55
"author": "Nick Alteen <[email protected]>",
66
"homepage": "https://github.com/issue-ops/releaser#readme",
77
"repository": {

src/main.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,23 @@ export async function run(): Promise<void> {
3838
const github: Octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })
3939

4040
try {
41-
// Create the release
42-
const response = await github.rest.repos.createRelease({
41+
// Create the API options
42+
const options: any = {
4343
owner,
4444
repo,
4545
tag_name: tag,
46-
target_commitish: target === '' ? undefined : target,
4746
name,
48-
body: notes === '' ? undefined : notes,
4947
draft,
5048
prerelease,
5149
generate_release_notes: generateReleaseNotes
52-
})
50+
}
51+
52+
// Only add these options if they were provided
53+
if (target !== '') options.target_commitish = target
54+
if (notes !== '') options.body = notes
55+
56+
// Create the release
57+
const response = await github.rest.repos.createRelease(options)
5358

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

0 commit comments

Comments
 (0)