Skip to content

Commit

Permalink
Merge branch 'trunk' into 5099-gh-release-create-upload-expand-glob-p…
Browse files Browse the repository at this point in the history
…atterns-on-windows
  • Loading branch information
iamazeem authored Feb 12, 2025
2 parents d9bfa60 + cdb44f8 commit f0ac3bc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/attestation/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions pkg/cmd/attestation/verify/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions pkg/cmd/repo/setdefault/setdefault.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/repo/setdefault/setdefault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit f0ac3bc

Please sign in to comment.