Skip to content

Commit d22e5c8

Browse files
committed
feat: create a GitHub discussion via API flag if a discussion category name was provided
1 parent 3fc007b commit d22e5c8

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Diff for: packages/conventional-github-releaser/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ Default: `1`
129129

130130
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.
131131

132+
#### discussion
133+
134+
Default: unset
135+
136+
The discussion category name, which when given, will have GitHub automatically create a discussion in this category from the release.
137+
132138
##### name
133139

134140
Default: same as version tag

Diff for: packages/conventional-github-releaser/src/cli.js

100644100755
+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const cli = meow({
2828
If 0, the whole changelog will be regenerated and the outfile will be overwritten
2929
Default: 1
3030
31+
-d, --discussion The discussion category name, which when given, will have GitHub automatically create a discussion in this category from the release.
32+
Default: not set
33+
3134
-v, --verbose Verbose output. Use this for debugging
3235
Default: false
3336
@@ -63,6 +66,10 @@ const cli = meow({
6366
default: 1,
6467
type: 'number'
6568
},
69+
discussion: {
70+
alias: 'd',
71+
type: 'string'
72+
},
6673
verbose: {
6774
alias: 'v',
6875
default: false,
@@ -123,6 +130,7 @@ const changelogOpts = {
123130
path: flags.pkg
124131
},
125132
releaseCount: flags.releaseCount,
133+
discussion: flags.discussion,
126134
draft: flags.draft
127135
}
128136

Diff for: packages/conventional-github-releaser/src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ function conventionalGithubReleaser (auth, changelogOpts, context, gitRawCommits
8585
target_commitish: changelogOpts.targetCommitish
8686
}
8787
}
88+
if (changelogOpts.discussion) {
89+
debug(`discussions enabled`, changelogOpts.discussion)
90+
options.body.discussion_category_name = changelogOpts.discussion
91+
}
8892
debug(`posting %o to the following URL - ${url}`, options)
8993

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

0 commit comments

Comments
 (0)