Skip to content

Commit

Permalink
Add support for creating draft PRs.
Browse files Browse the repository at this point in the history
I prefer to use the GitHub UI to do a last check on the generated PRs
before sending them for review. This change adds a user config option
`createDraftPRs` that, when set to true, creates new PRs as drafts.

commit-id:d78551e5
  • Loading branch information
amartani authored and Eitan Joffe committed Jan 22, 2022
1 parent 36ec360 commit 108fb5d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type UserConfig struct {
LogGitCommands bool `default:"true" yaml:"logGitCommands"`
LogGitHubCalls bool `default:"true" yaml:"logGitHubCalls"`
StatusBitsHeader bool `default:"true" yaml:"statusBitsHeader"`
CreateDraftPRs bool `default:"false" yaml:"createDraftPRs"`

Stargazer bool `default:"false" yaml:"stargazer"`
RunCount int `default:"0" yaml:"runcount"`
Expand Down
1 change: 1 addition & 0 deletions github/githubclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ func (c *client) CreatePullRequest(ctx context.Context,
HeadRefName: githubv4.String(headRefName),
Title: githubv4.String(commit.Subject),
Body: &commitBody,
Draft: githubv4.NewBoolean(githubv4.Boolean(c.config.User.CreateDraftPRs)),
}
err := c.api.Mutate(ctx, &mutation, input, nil)
check(err)
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ User specific configuration is saved to .spr.yml in the user home directory.
| logGitCommands | bool | true | logs all git commands to stdout |
| logGitHubCalls | bool | true | logs all github api calls to stdout |
| statusBitsHeader | bool | true | show status bits type headers |
| createDraftPRs | bool | false | new pull requests are created as draft |

Happy Coding!
-------------
Expand Down

0 comments on commit 108fb5d

Please sign in to comment.