File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ You can pass repo in different format, it will be parsed using
3232Optional arguments:
3333
3434```
35- --branch <master>
35+ --branch <master>
3636```
3737
3838Aliases: ` --repo -r ` , ` --message -m ` , ` --branch -b `
@@ -49,7 +49,7 @@ emptyGitHubCommit({
4949 repo: ' repo name' ,
5050 token: process .env .TOKEN ,
5151 message: ' my message' ,
52- fullyQualifiedRef : ' heads/ develop'
52+ branch : ' develop' // "master" is default
5353}).then (console .log , e => {
5454 console .error (e)
5555 process .exit (1 )
@@ -63,7 +63,7 @@ to make API calls.
6363
6464### Testing
6565
66- To test this project I created dummy repo
66+ To test this project I created dummy repo
6767[ test-make-empty-github-commit] ( https://github.com/bahmutov/test-make-empty-github-commit ) .
6868See its [ commit history] ( https://github.com/bahmutov/test-make-empty-github-commit/commits/master )
6969to see empty commit messages created from this repository using
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ emptyGitHubCommit({
4545 repo : repo ,
4646 token : token ,
4747 message : options . message ,
48- fullyQualifiedRef : `heads/ ${ options . branch } `
48+ branch : options . branch
4949} ) . then ( console . log , e => {
5050 console . error ( e )
5151 process . exit ( 1 )
Original file line number Diff line number Diff line change @@ -103,7 +103,14 @@ function emptyGitHubCommit (opts) {
103103 }
104104 data . owner = opts . owner
105105 data . repo = opts . repo
106- data . fullyQualifiedRef = opts . fullyQualifiedRef || 'heads/master'
106+
107+ if ( opts . branch ) {
108+ data . fullyQualifiedRef = `heads/${ opts . branch } `
109+ } else {
110+ const defaultRef = 'heads/master'
111+ data . fullyQualifiedRef = opts . fullyQualifiedRef || defaultRef
112+ }
113+
107114 data . forceUpdate = opts . forceUpdate || false
108115 data . commitMessage =
109116 opts . message ||
@@ -131,7 +138,7 @@ if (!module.parent) {
131138 owner : 'bahmutov' ,
132139 repo : 'commit-to-github' ,
133140 token : process . env . TOKEN ,
134- fullyQualifiedRef : 'heads/ master'
141+ branch : 'master'
135142 } ) . then ( console . log , e => {
136143 console . error ( e )
137144 process . exit ( 1 )
You can’t perform that action at this time.
0 commit comments