Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create a GitHub discussion via API flag if a discussion category name was provided #227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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