Skip to content

Commit 434a304

Browse files
authored
Merge pull request #26 from alanzhou-okta/master
Update github API call & version and add draft release option
2 parents 0330f1b + c7bcd48 commit 434a304

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ $ conventional-github-releaser --help # for more details
164164

165165
You can supply your auth token by a flag `-t` or `--token`. You can also set up an environment variable `CONVENTIONAL_GITHUB_RELEASER_TOKEN` to avoid typing your token every time.
166166

167+
You can also submit your release as a draft version via the '--draft' flag. This allows you to review the and edit the release notes before an official release.
168+
167169
Note: If all results error, it will print the error messages to stderr and exit with code `1`.
168170

169171

cli.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ var cli = meow({
3131
' -n, --config A filepath of your config script',
3232
' Example of a config script: https://github.com/conventional-changelog/conventional-changelog-angular/blob/master/index.js',
3333
'',
34-
' -c, --context A filepath of a javascript that is used to define template variables'
34+
' -c, --context A filepath of a javascript that is used to define template variables',
35+
'',
36+
' -d, --draft Publishes a draft instead of a real release',
37+
' Default: false'
3538
]
3639
}, {
3740
alias: {
@@ -41,7 +44,8 @@ var cli = meow({
4144
r: 'releaseCount',
4245
v: 'verbose',
4346
n: 'config',
44-
c: 'context'
47+
c: 'context',
48+
d: 'draft'
4549
}
4650
});
4751

@@ -85,7 +89,8 @@ var changelogOpts = {
8589
pkg: {
8690
path: flags.pkg
8791
},
88-
releaseCount: flags.releaseCount
92+
releaseCount: flags.releaseCount,
93+
draft: flags.draft
8994
};
9095

9196
if (flags.verbose) {

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,16 @@ function conventionalGithubReleaser(auth, changelogOpts, context, gitRawCommitsO
8181

8282
var prerelease = semver.parse(version).prerelease.length > 0;
8383

84-
var promise = Q.nfcall(github.releases.createRelease, {
84+
var draft = changelogOpts.draft || false;
85+
86+
var promise = Q.nfcall(github.repos.createRelease, {
8587
// jscs:disable
8688
owner: context.owner,
8789
repo: context.repository,
8890
tag_name: version,
8991
body: chunk.log,
9092
prerelease: prerelease,
93+
draft: draft,
9194
target_commitish: changelogOpts.targetCommitish,
9295
name: changelogOpts.name || version
9396
// jscs:enable

0 commit comments

Comments
 (0)