Skip to content

Commit

Permalink
Add a flag to create draft pull requests (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluekeyes authored Jan 6, 2024
1 parent 7728eb3 commit 61e7d05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Options:
-base-branch=branch The branch to target with the pull request. If unset,
use the repository's default branch.
-draft Create a draft pull request.
-force Update the head branch even if it exists and is not a
fast-forward.
Expand Down
5 changes: 5 additions & 0 deletions cmd/patch2pr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func die(code int, err error) {

type Options struct {
BaseBranch string
Draft bool
Force bool
HeadBranch string
OutputJSON bool
Expand All @@ -50,6 +51,7 @@ func main() {
fs.Usage = func() {}

fs.StringVar(&opts.BaseBranch, "base-branch", "", "base-branch")
fs.BoolVar(&opts.Draft, "draft", false, "draft")
fs.BoolVar(&opts.Force, "force", false, "force")
fs.StringVar(&opts.HeadBranch, "head-branch", "patch2pr", "head-branch")
fs.BoolVar(&opts.OutputJSON, "json", false, "json")
Expand Down Expand Up @@ -224,6 +226,7 @@ func execute(ctx context.Context, client *github.Client, patchFile string, opts
Title: &title,
Body: &body,
Base: &baseBranch,
Draft: &opts.Draft,
}); err != nil {
return nil, fmt.Errorf("create pull request failed: %w", err)
}
Expand Down Expand Up @@ -345,6 +348,8 @@ Options:
-base-branch=branch The branch to target with the pull request. If unset,
use the repository's default branch.
-draft Create a draft pull request.
-force Update the head branch even if it exists and is not a
fast-forward.
Expand Down

0 comments on commit 61e7d05

Please sign in to comment.