Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:cli/cli into jg/liveshare-keepalive
Browse files Browse the repository at this point in the history
  • Loading branch information
josebalius committed Oct 13, 2021
2 parents 5170a29 + 675ee31 commit 97b52b3
Show file tree
Hide file tree
Showing 28 changed files with 742 additions and 281 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
4 changes: 4 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: Code Scanning

on:
push:
branches: [trunk]
pull_request:
branches: [trunk]
paths-ignore:
- '**/*.md'
schedule:
- cron: "0 0 * * 0"

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/prauto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
PRNUM: ${{ github.event.pull_request.number }}
PRHEAD: ${{ github.event.pull_request.head.label }}
PRAUTHOR: ${{ github.event.pull_request.user.login }}
PR_AUTHOR_TYPE: ${{ github.event.pull_request.user.type }}
if: "!github.event.pull_request.draft"
run: |
commentPR () {
Expand Down Expand Up @@ -42,7 +43,7 @@ jobs:
' -f colID="$(colID "Needs review")" -f prID="$PRID"
}
if gh api orgs/cli/public_members/$PRAUTHOR --silent 2>/dev/null
if [ "$PR_AUTHOR_TYPE" = "Bot" ] || gh api orgs/cli/public_members/$PRAUTHOR --silent 2>/dev/null
then
if ! errtext="$(addToBoard 2>&1)"
then
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If anything feels off, or if you feel that some functionality is missing, please

### macOS

`gh` is available via [Homebrew][], [MacPorts][], [Conda][], and as a downloadable binary from the [releases page][].
`gh` is available via [Homebrew][], [MacPorts][], [Conda][], [Spack][], and as a downloadable binary from the [releases page][].

#### Homebrew

Expand All @@ -41,15 +41,21 @@ If anything feels off, or if you feel that some functionality is missing, please

Additional Conda installation options available on the [gh-feedstock page](https://github.com/conda-forge/gh-feedstock#installing-gh).

#### Spack

| Install: | Upgrade: |
| ------------------ | ---------------------------------------- |
| `spack install gh` | `spack uninstall gh && spack install gh` |

### Linux & BSD

`gh` is available via [Homebrew](#homebrew), [Conda](#Conda), and as downloadable binaries from the [releases page][].
`gh` is available via [Homebrew](#homebrew), [Conda](#conda), [Spack](#spack), and as downloadable binaries from the [releases page][].

For instructions on specific distributions and package managers, see [Linux & BSD installation](./docs/install_linux.md).

### Windows

`gh` is available via [WinGet][], [scoop][], [Chocolatey][], [Conda](#Conda), and as downloadable MSI.
`gh` is available via [WinGet][], [scoop][], [Chocolatey][], [Conda](#conda), and as downloadable MSI.

#### WinGet

Expand Down Expand Up @@ -99,6 +105,7 @@ tool. Check out our [more detailed explanation][gh-vs-hub] to learn more.
[scoop]: https://scoop.sh
[Chocolatey]: https://chocolatey.org
[Conda]: https://docs.conda.io/en/latest/
[Spack]: https://spack.io
[releases page]: https://github.com/cli/cli/releases/latest
[hub]: https://github.com/github/hub
[contributing]: ./.github/CONTRIBUTING.md
Expand Down
26 changes: 0 additions & 26 deletions api/queries_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package api

import (
"context"
"errors"
"fmt"
"io"
"net/http"
"strings"
"time"
Expand Down Expand Up @@ -267,30 +265,6 @@ func (pr *PullRequest) DisplayableReviews() PullRequestReviews {
return PullRequestReviews{Nodes: published, TotalCount: len(published)}
}

func (c Client) PullRequestDiff(baseRepo ghrepo.Interface, prNumber int) (io.ReadCloser, error) {
url := fmt.Sprintf("%srepos/%s/pulls/%d",
ghinstance.RESTPrefix(baseRepo.RepoHost()), ghrepo.FullName(baseRepo), prNumber)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}

req.Header.Set("Accept", "application/vnd.github.v3.diff; charset=utf-8")

resp, err := c.http.Do(req)
if err != nil {
return nil, err
}

if resp.StatusCode == 404 {
return nil, errors.New("pull request not found")
} else if resp.StatusCode != 200 {
return nil, HandleHTTPError(resp)
}

return resp.Body, nil
}

type pullRequestFeature struct {
HasReviewDecision bool
HasStatusCheckRollup bool
Expand Down
19 changes: 19 additions & 0 deletions api/queries_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,25 @@ func (r Repository) ViewerCanTriage() bool {
}
}

func FetchRepository(client *Client, repo ghrepo.Interface, fields []string) (*Repository, error) {
query := fmt.Sprintf(`query RepositoryInfo($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {%s}
}`, RepositoryGraphQL(fields))

variables := map[string]interface{}{
"owner": repo.RepoOwner(),
"name": repo.RepoName(),
}

var result struct {
Repository Repository
}
if err := client.GraphQL(repo.RepoHost(), query, variables, &result); err != nil {
return nil, err
}
return InitRepoHostname(&result.Repository, repo.RepoHost()), nil
}

func GitHubRepo(client *Client, repo ghrepo.Interface) (*Repository, error) {
query := `
fragment repo on Repository {
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ go 1.16
require (
github.com/AlecAivazis/survey/v2 v2.3.2
github.com/MakeNowJust/heredoc v1.0.0
github.com/briandowns/spinner v1.11.1
github.com/briandowns/spinner v1.16.0
github.com/charmbracelet/glamour v0.3.0
github.com/cli/browser v1.1.0
github.com/cli/oauth v0.8.0
github.com/cli/safeexec v1.0.0
github.com/cpuguy83/go-md2man/v2 v2.0.0
github.com/creack/pty v1.1.13
github.com/cpuguy83/go-md2man/v2 v2.0.1
github.com/creack/pty v1.1.16
github.com/fatih/camelcase v1.0.0
github.com/gabriel-vasile/mimetype v1.1.2
github.com/google/go-cmp v0.5.5
github.com/gabriel-vasile/mimetype v1.4.0
github.com/google/go-cmp v0.5.6
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/gorilla/websocket v1.4.2
github.com/hashicorp/go-version v1.2.1
github.com/hashicorp/go-version v1.3.0
github.com/henvic/httpretty v0.0.6
github.com/itchyny/gojq v0.12.4
github.com/itchyny/gojq v0.12.5
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/mattn/go-colorable v0.1.8
github.com/mattn/go-isatty v0.0.13
github.com/mattn/go-colorable v0.1.11
github.com/mattn/go-isatty v0.0.14
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
github.com/muesli/reflow v0.2.1-0.20210502190812-c80126ec2ad5
github.com/muesli/termenv v0.8.1
github.com/muesli/termenv v0.9.0
github.com/muhammadmuzzammil1998/jsonc v0.0.0-20201229145248-615b0916ca38
github.com/olekukonko/tablewriter v0.0.5
github.com/opentracing/opentracing-go v1.1.0
Expand All @@ -39,7 +39,7 @@ require (
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6
golang.org/x/term v0.0.0-20210503060354-a79de5458b56
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)
Expand Down
Loading

0 comments on commit 97b52b3

Please sign in to comment.