Merge branch 'trunk' into 5099-gh-release-create-upload-expand-glob-patterns-on-windows
This commit is contained in:
commit
f0ac3bcf3f
5 changed files with 21 additions and 6 deletions
|
|
@ -99,7 +99,7 @@ func (r *ResolvedRemotes) BaseRepo(io *iostreams.IOStreams) (ghrepo.Interface, e
|
|||
cs := io.ColorScheme()
|
||||
|
||||
fmt.Fprintf(io.ErrOut,
|
||||
"%s No default remote repository has been set for this directory.\n",
|
||||
"%s No default remote repository has been set. To learn more about the default repository, run: gh repo set-default --help\n",
|
||||
cs.FailureIcon())
|
||||
|
||||
fmt.Fprintln(io.Out)
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ func runVerify(opts *Options) error {
|
|||
filteredAttestations := verification.FilterAttestations(ec.PredicateType, attestations)
|
||||
if len(filteredAttestations) == 0 {
|
||||
opts.Logger.Printf(opts.Logger.ColorScheme.Red("✗ No attestations found with predicate type: %s\n"), opts.PredicateType)
|
||||
return err
|
||||
return fmt.Errorf("no matching predicate found")
|
||||
}
|
||||
attestations = filteredAttestations
|
||||
|
||||
|
|
|
|||
|
|
@ -501,6 +501,18 @@ func TestRunVerify(t *testing.T) {
|
|||
require.Nil(t, runVerify(&customOpts))
|
||||
})
|
||||
|
||||
t.Run("with valid OCI artifact with UseBundleFromRegistry flag and unknown predicate type", func(t *testing.T) {
|
||||
customOpts := publicGoodOpts
|
||||
customOpts.ArtifactPath = "oci://ghcr.io/github/test"
|
||||
customOpts.BundlePath = ""
|
||||
customOpts.UseBundleFromRegistry = true
|
||||
customOpts.PredicateType = "https://predicate.type"
|
||||
|
||||
err := runVerify(&customOpts)
|
||||
require.Error(t, err)
|
||||
require.ErrorContains(t, err, "no matching predicate found")
|
||||
})
|
||||
|
||||
t.Run("with valid OCI artifact with UseBundleFromRegistry flag but no bundle return from registry", func(t *testing.T) {
|
||||
customOpts := publicGoodOpts
|
||||
customOpts.ArtifactPath = "oci://ghcr.io/github/test"
|
||||
|
|
|
|||
|
|
@ -119,15 +119,18 @@ func setDefaultRun(opts *SetDefaultOptions) error {
|
|||
|
||||
currentDefaultRepo, _ := remotes.ResolvedRemote()
|
||||
|
||||
cs := opts.IO.ColorScheme()
|
||||
|
||||
if opts.ViewMode {
|
||||
if currentDefaultRepo != nil {
|
||||
fmt.Fprintln(opts.IO.Out, displayRemoteRepoName(currentDefaultRepo))
|
||||
} else {
|
||||
fmt.Fprintln(opts.IO.ErrOut, "no default repository has been set; use `gh repo set-default` to select one")
|
||||
fmt.Fprintf(opts.IO.ErrOut,
|
||||
"%s No default remote repository has been set. To learn more about the default repository, run: gh repo set-default --help\n",
|
||||
cs.FailureIcon())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
cs := opts.IO.ColorScheme()
|
||||
|
||||
if opts.UnsetMode {
|
||||
var msg string
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ func TestDefaultRun(t *testing.T) {
|
|||
Repo: repo1,
|
||||
},
|
||||
},
|
||||
wantStderr: "no default repository has been set; use `gh repo set-default` to select one\n",
|
||||
wantStderr: "X No default remote repository has been set. To learn more about the default repository, run: gh repo set-default --help\n",
|
||||
},
|
||||
{
|
||||
name: "view mode no current default",
|
||||
|
|
@ -188,7 +188,7 @@ func TestDefaultRun(t *testing.T) {
|
|||
Repo: repo1,
|
||||
},
|
||||
},
|
||||
wantStderr: "no default repository has been set; use `gh repo set-default` to select one\n",
|
||||
wantStderr: "X No default remote repository has been set. To learn more about the default repository, run: gh repo set-default --help\n",
|
||||
},
|
||||
{
|
||||
name: "view mode with base resolved current default",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue