-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
- Loading branch information
1 parent
6a6def9
commit bbc6425
Showing
8 changed files
with
394 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package verifymergeable | ||
|
||
import ( | ||
"github.com/gittuf/gittuf/internal/repository" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
type options struct { | ||
baseBranch string | ||
} | ||
|
||
func (o *options) AddFlags(cmd *cobra.Command) { | ||
cmd.Flags().StringVar( | ||
&o.baseBranch, | ||
"into", | ||
"", | ||
"base branch to merge into", | ||
) | ||
cmd.MarkFlagRequired("into") //nolint:errcheck | ||
} | ||
|
||
func (o *options) Run(cmd *cobra.Command, args []string) error { | ||
repo, err := repository.LoadRepository() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return repo.VerifyMergeable(cmd.Context(), o.baseBranch, args[0]) | ||
} | ||
|
||
func New() *cobra.Command { | ||
o := &options{} | ||
cmd := &cobra.Command{ | ||
Use: "verify-mergeable", | ||
Short: "Verify if a branch can be merged into another using gittuf policies", | ||
Args: cobra.ExactArgs(1), | ||
RunE: o.Run, | ||
DisableAutoGenTag: true, | ||
} | ||
o.AddFlags(cmd) | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.