Skip to content

Commit

Permalink
feat: create a GitHub discussion via API flag if a discussion categor…
Browse files Browse the repository at this point in the history
…y name was provided
  • Loading branch information
gkatsev committed Feb 27, 2023
1 parent 3fc007b commit 6157717
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/conventional-github-releaser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ Default: `1`

How many releases of changelog you want to generate. It counts from the latest semver tag. Useful when you forgot to generate any previous releases. Set to `0` to regenerate all.

#### discussion

Default: unset

The discussion category name, which when given, will have GitHub automatically create a discussion in this category from the release.

##### name

Default: same as version tag
Expand Down
8 changes: 8 additions & 0 deletions packages/conventional-github-releaser/src/cli.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const cli = meow({
If 0, the whole changelog will be regenerated and the outfile will be overwritten
Default: 1
-d, --discussion The discussion category name, which when given, will have GitHub automatically create a discussion in this category from the release.
Default: not set
-v, --verbose Verbose output. Use this for debugging
Default: false
Expand Down Expand Up @@ -63,6 +66,10 @@ const cli = meow({
default: 1,
type: 'number'
},
discussion: {
alias: 'd',
type: 'string'
},
verbose: {
alias: 'v',
default: false,
Expand Down Expand Up @@ -123,6 +130,7 @@ const changelogOpts = {
path: flags.pkg
},
releaseCount: flags.releaseCount,
discussion: flags.discussion,
draft: flags.draft
}

Expand Down
3 changes: 3 additions & 0 deletions packages/conventional-github-releaser/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ function conventionalGithubReleaser (auth, changelogOpts, context, gitRawCommits
target_commitish: changelogOpts.targetCommitish
}
}
if (changelogOpts.discussion) {
options.body.discussion_category_name = changelogOpts.discussion
}
debug(`posting %o to the following URL - ${url}`, options)

// Set auth after debug output so that we don't print auth token to console.
Expand Down

0 comments on commit 6157717

Please sign in to comment.