Skip to content

Commit

Permalink
Merge pull request #16 from isometry/feature/pr-draft
Browse files Browse the repository at this point in the history
  • Loading branch information
isometry authored Jun 7, 2023
2 parents d1fe00e + 6c45fa9 commit dfd00e0
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 74 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Flags:
--create-branch create missing target branch (default true)
-d, --delete strings file-path to delete
-h, --help help for content
--pr-draft create pull request in draft mode
--pr-title string create pull request iff target branch is created and title is specified
-s, --separator string file-spec separator (default ":")
-u, --update strings file-spec to update
Expand Down
5 changes: 5 additions & 0 deletions cmd/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func init() {
viper.BindPFlag("pr-title", contentCmd.PersistentFlags().Lookup("pr-title"))
viper.BindEnv("pr-title", "GHUP_PR_TITLE")

contentCmd.PersistentFlags().Bool("pr-draft", false, "create pull request in draft mode")
viper.BindPFlag("pr-draft", contentCmd.PersistentFlags().Lookup("pr-draft"))
viper.BindEnv("pr-draft", "GHUP_PR_DRAFT")

contentCmd.PersistentFlags().String("base-branch", "", `base branch name (default: "[remote-default-branch])"`)
viper.BindPFlag("base-branch", contentCmd.PersistentFlags().Lookup("base-branch"))
viper.BindEnv("base-branch", "GHUP_BASE_BRANCH")
Expand Down Expand Up @@ -167,6 +171,7 @@ func runContentCmd(cmd *cobra.Command, args []string) (err error) {
input := githubv4.CreatePullRequestInput{
RepositoryID: repoInfo.NodeID,
BaseRefName: githubv4.String(baseBranch),
Draft: githubv4.NewBoolean(githubv4.Boolean(viper.GetBool("pr-draft"))),
HeadRefName: githubv4.String(branch),
Title: githubv4.String(title),
}
Expand Down
23 changes: 12 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,56 @@ go 1.19

require (
github.com/apex/log v1.9.0
github.com/go-git/go-git/v5 v5.6.1
github.com/go-git/go-git/v5 v5.7.0
github.com/google/go-github/v50 v50.2.0
github.com/shurcooL/githubv4 v0.0.0-20230424031643-6cea62ecd5a9
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.15.0
github.com/spf13/viper v1.16.0
github.com/whilp/git-urls v1.0.0
golang.org/x/oauth2 v0.8.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230426101702-58e86b294756 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230528122434-6f98819771a1 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.4.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/skeema/knownhosts v1.1.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.8.0 // indirect
golang.org/x/tools v0.9.3 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit dfd00e0

Please sign in to comment.