Skip to content

Commit

Permalink
Syncer should automatically merge PRs or enable auto merge (#15)
Browse files Browse the repository at this point in the history
As part of supporting taking over the dev environment
(#13)
we want hydros to be automerge PRs.

This also removes the need to rely on bulldozer or similar apps to
automatically
merge PRs.

The syncer will automatically enable auto merge if a PR can't be merged
immediately.

To prevent automerge users should set appropriate branch protections
(e.g. require approvals)

The original code was based on GitHub's CLI's code for merging.
https://github.com/cli/cli/blob/trunk/pkg/cmd/pr/merge/merge.go

The hydros code is much simpler since its more oppinionated and requires
fewer options
than what the CLI supports.

Copy ghrepo and ghinstance from github.com/CLI/CLI

  * These are internal packages of that repository.
  * Some of the code for the merge functionality depends on them.

  * Remove the dependency on kubeflow/testing for ghrepo
* We needed to pull in some changes from github's latest copy of ghrepo

* Upgrade to v2 of the github CLI in terms of depenencies
  • Loading branch information
jlewi authored Dec 1, 2022
1 parent 17d1614 commit 711c7de
Show file tree
Hide file tree
Showing 11 changed files with 1,247 additions and 155 deletions.
52 changes: 31 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ require (
github.com/otiai10/copy v1.6.0
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pkg/errors v0.9.1
github.com/shurcooL/githubv4 v0.0.0-20200414012201-bbc966b061dd
github.com/spf13/cobra v1.3.0
github.com/stretchr/testify v1.7.0
github.com/shurcooL/githubv4 v0.0.0-20220520033151-0b4e3294ff00
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.7.5
go.uber.org/zap v1.19.1
gopkg.in/DataDog/dd-trace-go.v1 v1.33.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.23.5
k8s.io/apimachinery v0.23.5
sigs.k8s.io/kustomize/api v0.11.4
sigs.k8s.io/kustomize/kyaml v0.13.6
)

require (
github.com/charmbracelet/glamour v0.3.0 // indirect
github.com/charmbracelet/glamour v0.5.1-0.20220727184942-e70ff2d969da // indirect
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 // indirect
github.com/evanphx/json-patch/v5 v5.6.0
k8s.io/client-go v1.5.2 // indirect
Expand All @@ -47,7 +47,10 @@ require (

require (
cloud.google.com/go/secretmanager v1.9.0
github.com/AlecAivazis/survey/v2 v2.3.6
github.com/MakeNowJust/heredoc v1.0.0
github.com/PrimerAI/go-micro-utils-public/gmu v0.0.0-20220526222947-c3eb3c2c79c8
github.com/cli/cli/v2 v2.20.2
github.com/go-git/go-git/v5 v5.4.2
github.com/thanhpk/randstr v1.0.4
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
Expand All @@ -73,26 +76,29 @@ require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/alecthomas/chroma v0.8.2 // indirect
github.com/alecthomas/chroma v0.10.0 // indirect
github.com/apex/log v1.9.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/bmatcuk/doublestar v1.3.4 // indirect
github.com/briandowns/spinner v1.11.1 // indirect
github.com/briandowns/spinner v1.18.1 // indirect
github.com/buildpacks/imgutil v0.0.0-20210209163614-30601e371ce3 // indirect
github.com/buildpacks/lifecycle v0.10.2 // indirect
github.com/buildpacks/pack v0.18.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cli/browser v1.1.0 // indirect
github.com/cli/go-gh v0.1.3-0.20221102170023-e3ec45fb1d1b // indirect
github.com/cli/safeexec v1.0.0 // indirect
github.com/cli/shurcooL-graphql v0.0.2 // indirect
github.com/containerd/containerd v1.5.9 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.11.0 // indirect
github.com/containerd/ttrpc v1.1.0 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.2.0 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/docker/cli v20.10.12+incompatible // indirect
github.com/docker/distribution v2.8.0+incompatible // indirect
github.com/docker/docker v20.10.12+incompatible // indirect
Expand Down Expand Up @@ -123,26 +129,29 @@ require (
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 // indirect
github.com/henvic/httpretty v0.0.5 // indirect
github.com/henvic/httpretty v0.0.6 // indirect
github.com/heroku/color v0.0.6 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/itchyny/gojq v0.12.8 // indirect
github.com/itchyny/timefmt-go v0.1.3 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.14.2 // indirect
github.com/krishicks/yaml-patch v0.0.10 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.10 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/microcosm-cc/bluemonday v1.0.6 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/microcosm-cc/bluemonday v1.0.20 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
Expand All @@ -155,8 +164,8 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/muesli/reflow v0.2.0 // indirect
github.com/muesli/termenv v0.8.1 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.12.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.17.0 // indirect
Expand All @@ -170,18 +179,19 @@ require (
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/rivo/uniseg v0.1.0 // indirect
github.com/rivo/uniseg v0.4.2 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20201211074657-223ce5d391b0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect
github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e // indirect
github.com/tinylib/msgp v1.1.2 // indirect
github.com/vbatts/tar-split v0.11.2 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
github.com/yuin/goldmark v1.4.1 // indirect
github.com/yuin/goldmark v1.4.4 // indirect
github.com/yuin/goldmark-emoji v1.0.1 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/otel v0.20.0 // indirect
Expand All @@ -199,7 +209,7 @@ require (
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
Expand Down
Loading

0 comments on commit 711c7de

Please sign in to comment.