Merge remote-tracking branch 'origin/trunk' into cmbrose/no-auto-key-if-uploaded
This commit is contained in:
commit
4053880776
7 changed files with 33 additions and 17 deletions
|
|
@ -18,10 +18,8 @@ const (
|
|||
accept = "Accept"
|
||||
authorization = "Authorization"
|
||||
cacheTTL = "X-GH-CACHE-TTL"
|
||||
contentType = "Content-Type"
|
||||
graphqlFeatures = "GraphQL-Features"
|
||||
mergeQueue = "merge_queue"
|
||||
timeZone = "Time-Zone"
|
||||
userAgent = "User-Agent"
|
||||
)
|
||||
|
||||
|
|
@ -249,16 +247,12 @@ func clientOptions(hostname string, transport http.RoundTripper) ghAPI.ClientOpt
|
|||
// so let go-gh know that it does not need to resolve them.
|
||||
opts := ghAPI.ClientOptions{
|
||||
AuthToken: "none",
|
||||
// Blank values for Accept, Authorization, Content-Type, Time-Zone, and User-Agent headers.
|
||||
Headers: map[string]string{
|
||||
accept: "",
|
||||
authorization: "",
|
||||
contentType: "",
|
||||
timeZone: "",
|
||||
userAgent: "",
|
||||
},
|
||||
Host: hostname,
|
||||
Transport: transport,
|
||||
Host: hostname,
|
||||
SkipDefaultHeaders: true,
|
||||
Transport: transport,
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package api
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
|
@ -422,8 +423,8 @@ func RepoNetwork(client *Client, repos []ghrepo.Interface) (RepoNetworkResult, e
|
|||
%s
|
||||
}
|
||||
`, strings.Join(queries, "")), nil, &graphqlResult)
|
||||
graphqlError, isGraphQLError := err.(*GraphQLError)
|
||||
if isGraphQLError {
|
||||
var graphqlError GraphQLError
|
||||
if errors.As(err, &graphqlError) {
|
||||
// If the only errors are that certain repositories are not found,
|
||||
// continue processing this response instead of returning an error
|
||||
tolerated := true
|
||||
|
|
|
|||
3
go.mod
3
go.mod
|
|
@ -9,7 +9,7 @@ require (
|
|||
github.com/charmbracelet/glamour v0.4.0
|
||||
github.com/charmbracelet/lipgloss v0.5.0
|
||||
github.com/cli/browser v1.1.0
|
||||
github.com/cli/go-gh v0.0.4-0.20220623035622-91ca4ef447d4
|
||||
github.com/cli/go-gh v0.0.4-0.20220725193052-79f89db738dc
|
||||
github.com/cli/oauth v0.9.0
|
||||
github.com/cli/safeexec v1.0.0
|
||||
github.com/cli/shurcooL-graphql v0.0.1
|
||||
|
|
@ -65,6 +65,7 @@ require (
|
|||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a // indirect
|
||||
github.com/stretchr/objx v0.4.0 // indirect
|
||||
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e // indirect
|
||||
github.com/yuin/goldmark v1.4.4 // indirect
|
||||
github.com/yuin/goldmark-emoji v1.0.1 // indirect
|
||||
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
|
||||
|
|
|
|||
7
go.sum
7
go.sum
|
|
@ -58,8 +58,8 @@ github.com/cli/browser v1.1.0 h1:xOZBfkfY9L9vMBgqb1YwRirGu6QFaQ5dP/vXt5ENSOY=
|
|||
github.com/cli/browser v1.1.0/go.mod h1:HKMQAt9t12kov91Mn7RfZxyJQQgWgyS/3SZswlZ5iTI=
|
||||
github.com/cli/crypto v0.0.0-20210929142629-6be313f59b03 h1:3f4uHLfWx4/WlnMPXGai03eoWAI+oGHJwr+5OXfxCr8=
|
||||
github.com/cli/crypto v0.0.0-20210929142629-6be313f59b03/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
github.com/cli/go-gh v0.0.4-0.20220623035622-91ca4ef447d4 h1:6WrekNBE2Y+Xl9OCl7vsg49SSN68hwaVryfEawQevaQ=
|
||||
github.com/cli/go-gh v0.0.4-0.20220623035622-91ca4ef447d4/go.mod h1:Y/QFb/VxnXQH0W4VlP+507HVxMzQ430x8kdjUuVcono=
|
||||
github.com/cli/go-gh v0.0.4-0.20220725193052-79f89db738dc h1:qHm0KQPwmr2gsov+Vqsb0bm5jwWykf8zfUS0Q0/xeR4=
|
||||
github.com/cli/go-gh v0.0.4-0.20220725193052-79f89db738dc/go.mod h1:YDzUlo0eCH9G0jY2CONIPYSuIMiQiSDnWaTB/YW6yfk=
|
||||
github.com/cli/oauth v0.9.0 h1:nxBC0Df4tUzMkqffAB+uZvisOwT3/N9FpkfdTDtafxc=
|
||||
github.com/cli/oauth v0.9.0/go.mod h1:qd/FX8ZBD6n1sVNQO3aIdRxeu5LGw9WhKnYhIIoC2A4=
|
||||
github.com/cli/safeexec v1.0.0 h1:0VngyaIyqACHdcMNWfo6+KdUYnqEr2Sg+bSP1pdF+dI=
|
||||
|
|
@ -242,6 +242,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.5 h1:s5PTfem8p8EbKQOctVV53k6jCJt3UX4IEJzwh+C324Q=
|
||||
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e h1:BuzhfgfWQbX0dWzYzT1zsORLnHRv3bcRcsaUk0VmXA8=
|
||||
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e/go.mod h1:/Tnicc6m/lsJE0irFMA0LfIwTBo4QP7A8IfyIv4zZKI=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
|
|
@ -365,6 +367,7 @@ golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command {
|
|||
|
||||
See the list of available extensions at <https://github.com/topics/gh-extension>.
|
||||
`, "`"),
|
||||
Aliases: []string{"extensions"},
|
||||
Aliases: []string{"extensions", "ext"},
|
||||
}
|
||||
|
||||
extCmd.AddCommand(
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ func (s *StatusGetter) LoadSearchResults() error {
|
|||
if len(gqlErrors) == 0 {
|
||||
err = nil
|
||||
} else {
|
||||
err = &api.GraphQLError{
|
||||
err = api.GraphQLError{
|
||||
GQLError: ghAPI.GQLError{
|
||||
Errors: gqlErrors,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package jsoncolor
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
|
@ -49,7 +50,7 @@ func Write(w io.Writer, r io.Reader, indent string) error {
|
|||
fmt.Fprintf(w, "\x1b[%sm%s\x1b[m", colorDelim, tt)
|
||||
}
|
||||
default:
|
||||
b, err := json.Marshal(tt)
|
||||
b, err := marshalJSON(tt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -94,3 +95,19 @@ func Write(w io.Writer, r io.Reader, indent string) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// marshalJSON works like json.Marshal but with HTML-escaping disabled
|
||||
func marshalJSON(v interface{}) ([]byte, error) {
|
||||
buf := bytes.Buffer{}
|
||||
enc := json.NewEncoder(&buf)
|
||||
enc.SetEscapeHTML(false)
|
||||
if err := enc.Encode(v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bb := buf.Bytes()
|
||||
// omit trailing newline added by json.Encoder
|
||||
if len(bb) > 0 && bb[len(bb)-1] == '\n' {
|
||||
return bb[:len(bb)-1], nil
|
||||
}
|
||||
return bb, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue