Skip to content

Commit ed1a3a6

Browse files
committed
Merge remote-tracking branch 'origin/master' into wingkwong/master
2 parents 3e54a0e + 9acaca9 commit ed1a3a6

File tree

109 files changed

+10978
-1517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+10978
-1517
lines changed

.github/CONTRIBUTING.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,42 @@
66

77
Hi! Thanks for your interest in contributing to the GitHub CLI!
88

9-
Given that this project is very early and still in beta, we're only accepting pull requests for bug fixes right now. We'd love to
10-
hear about ideas for new features as issues, though!
9+
We accept pull requests for bug fixes and features where we've discussed the approach in an issue and given the go-ahead for a community member to work on it. We'd also love to hear about ideas for new features as issues.
1110

1211
Please do:
1312

1413
* open an issue if things aren't working as expected
1514
* open an issue to propose a significant change
16-
* open a PR to fix a bug
15+
* open a pull request to fix a bug
16+
* open a pull request to fix documentation about a command
17+
* open a pull request if a member of the GitHub CLI team has given the ok after discussion in an issue
1718

18-
## Submitting a bug fix
19+
Please avoid:
1920

20-
0. Clone this repository
21-
0. Create a new branch: `git checkout -b my-branch-name`
22-
0. Make your change, add tests, and ensure tests pass
23-
0. Make a PR: `gh pr create --web`
21+
* adding installation instructions specifically for your OS/package manager
22+
23+
## Building the project
24+
25+
Prerequisites:
26+
- Go 1.14
27+
28+
Build with: `make` or `go build -o bin/gh ./cmd/gh`
29+
30+
Run the new binary as: `./bin/gh`
31+
32+
Run tests with: `make test` or `go test ./...`
33+
34+
## Submitting a pull request
35+
36+
1. Create a new branch: `git checkout -b my-branch-name`
37+
1. Make your change, add tests, and ensure tests pass
38+
1. Submit a pull request: `gh pr create --web`
2439

2540
Contributions to this project are [released][legal] to the public under the [project's open source license][license].
2641

2742
Please note that this project adheres to a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
2843

29-
We generate manual pages from source on every release! You do not need to submit PRs for those specifically; the docs will get updated if your PR gets accepted.
44+
We generate manual pages from source on every release. You do not need to submit pull requests for documentation specifically; manual pages for commands will automatically get updated after your pull requests gets accepted.
3045

3146
## Resources
3247

.github/workflows/codeql.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Code Scanning
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: "0 0 * * 0"
7+
8+
jobs:
9+
CodeQL-Build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v2
15+
16+
- name: Initialize CodeQL
17+
uses: github/codeql-action/init@v1
18+
with:
19+
languages: go
20+
21+
- name: Perform CodeQL Analysis
22+
uses: github/codeql-action/analyze@v1

.github/workflows/go.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010

1111
steps:
12-
- name: Set up Go 1.13
13-
uses: actions/setup-go@v1
12+
- name: Set up Go 1.14
13+
uses: actions/setup-go@v2-beta
1414
with:
15-
go-version: 1.13
15+
go-version: 1.14
1616

17-
- name: Check out code into the Go module directory
17+
- name: Check out code
1818
uses: actions/checkout@v2
1919

20-
- name: Verify dependencies
21-
run: go mod verify
20+
- name: Download dependencies
21+
run: go mod download
22+
23+
- name: Run tests
24+
run: go test -race ./...
2225

2326
- name: Build
24-
shell: bash
25-
run: |
26-
go test ./...
27-
go build -v ./cmd/gh
27+
run: go build -v ./cmd/gh

.github/workflows/lint.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Lint
2+
on:
3+
push:
4+
paths:
5+
- "**.go"
6+
- go.mod
7+
- go.sum
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Set up Go 1.14
15+
uses: actions/setup-go@v2-beta
16+
with:
17+
go-version: 1.14
18+
19+
- name: Check out code
20+
uses: actions/checkout@v2
21+
22+
- name: Verify dependencies
23+
run: |
24+
go mod verify
25+
go mod download
26+
27+
LINT_VERSION=1.26.0
28+
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
29+
tar xz --strip-components 1 --wildcards \*/golangci-lint
30+
mkdir -p bin && mv golangci-lint bin/
31+
32+
- name: Run checks
33+
run: |
34+
STATUS=0
35+
assert-nothing-changed() {
36+
local diff
37+
"$@" >/dev/null || return 1
38+
if ! diff="$(git diff -U1 --color --exit-code)"; then
39+
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2
40+
git checkout -- .
41+
STATUS=1
42+
fi
43+
}
44+
45+
assert-nothing-changed go fmt ./...
46+
assert-nothing-changed go mod tidy
47+
48+
while read -r file linter msg; do
49+
IFS=: read -ra f <<<"$file"
50+
printf '::error file=%s,line=%s,col=%s::%s\n' "${f[0]}" "${f[1]}" "${f[2]}" "[$linter] $msg"
51+
STATUS=1
52+
done < <(bin/golangci-lint run --out-format tab)
53+
54+
exit $STATUS

.github/workflows/releases.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v2
14-
- name: Set up Go 1.13
15-
uses: actions/setup-go@v1
14+
- name: Set up Go 1.14
15+
uses: actions/setup-go@v2-beta
1616
with:
17-
go-version: 1.13
17+
go-version: 1.14
1818
- name: Generate changelog
1919
run: |
20+
echo ::set-env name=GORELEASER_CURRENT_TAG::${GITHUB_REF#refs/tags/}
2021
git fetch --unshallow
2122
script/changelog | tee CHANGELOG.md
2223
- name: Run GoReleaser
@@ -26,6 +27,35 @@ jobs:
2627
args: release --release-notes=CHANGELOG.md
2728
env:
2829
GITHUB_TOKEN: ${{secrets.UPLOAD_GITHUB_TOKEN}}
30+
- name: Bump homebrew-core formula
31+
uses: mislav/bump-homebrew-formula-action@v1
32+
if: "!contains(github.ref, '-')" # skip prereleases
33+
with:
34+
formula-name: gh
35+
env:
36+
COMMITTER_TOKEN: ${{ secrets.UPLOAD_GITHUB_TOKEN }}
37+
- name: Checkout documentation site
38+
if: "!contains(github.ref, '-')" # skip prereleases
39+
uses: actions/checkout@v2
40+
with:
41+
repository: github/cli.github.com
42+
path: site
43+
fetch-depth: 0
44+
token: ${{secrets.SITE_GITHUB_TOKEN}}
45+
- name: Publish documentation site
46+
if: "!contains(github.ref, '-')" # skip prereleases
47+
run: make site-publish
48+
- name: Move project cards
49+
if: "!contains(github.ref, '-')" # skip prereleases
50+
env:
51+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
52+
PENDING_COLUMN: 8189733
53+
DONE_COLUMN: 7110130
54+
run: |
55+
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
56+
api() { bin/hub api -H 'accept: application/vnd.github.inertia-preview+json' "$@"; }
57+
cards=$(api projects/columns/$PENDING_COLUMN/cards | jq ".[].id")
58+
for card in $cards; do api projects/columns/cards/$card/moves --field position=top --field column_id=$DONE_COLUMN; done
2959
msi:
3060
needs: goreleaser
3161
runs-on: windows-latest

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# VS Code
1010
.vscode
1111

12+
# IntelliJ
13+
.idea
14+
1215
# macOS
1316
.DS_Store
1417

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test:
2323
.PHONY: test
2424

2525
site:
26-
git worktree add site gh-pages
26+
git clone https://github.com/github/cli.github.com.git "$@"
2727

2828
site-docs: site
2929
git -C site pull
@@ -32,6 +32,15 @@ site-docs: site
3232
for f in site/manual/gh*.md; do sed -i.bak -e '/^### SEE ALSO/,$$d' "$$f"; done
3333
rm -f site/manual/*.bak
3434
git -C site add 'manual/gh*.md'
35-
git -C site commit -m 'update help docs'
36-
git -C site push
35+
git -C site commit -m 'update help docs' || true
3736
.PHONY: site-docs
37+
38+
site-publish: site-docs
39+
ifndef GITHUB_REF
40+
$(error GITHUB_REF is not set)
41+
endif
42+
sed -i.bak -E 's/(assign version = )".+"/\1"$(GITHUB_REF:refs/tags/v%=%)"/' site/index.html
43+
rm -f site/index.html.bak
44+
git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html
45+
git -C site push
46+
.PHONY: site-publish

README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# gh - The GitHub CLI tool
1+
# GitHub CLI
22

33
`gh` is GitHub on the command line, and it's now available in beta. It brings pull requests, issues, and other GitHub concepts to
44
the terminal next to where you are already working with `git` and your code.
@@ -7,7 +7,7 @@ the terminal next to where you are already working with `git` and your code.
77

88
## Availability
99

10-
While in beta, GitHub CLI is available for repos hosted on GitHub.com only. It does not currently support repositories hosted on GitHub Enterprise Server or other hosting providers.
10+
While in beta, GitHub CLI is available for repos hosted on GitHub.com only. It does not currently support repositories hosted on GitHub Enterprise Server or other hosting providers. We are planning support for GitHub Enterprise Server after GitHub CLI is out of beta (likely toward the end of 2020), and we want to ensure that the API endpoints we use are more widely available for GHES versions that most GitHub customers are on.
1111

1212
## We need your feedback
1313

@@ -21,26 +21,40 @@ And if you spot bugs or have features that you'd really like to see in `gh`, ple
2121

2222
- `gh pr [status, list, view, checkout, create]`
2323
- `gh issue [status, list, view, create]`
24+
- `gh repo [view, create, clone, fork]`
25+
- `gh config [get, set]`
2426
- `gh help`
2527

26-
Check out the [docs][] for more information.
28+
## Documentation
2729

30+
Read the [official docs](https://cli.github.com/manual/) for more information.
2831

2932
## Comparison with hub
3033

3134
For many years, [hub][] was the unofficial GitHub CLI tool. `gh` is a new project for us to explore
3235
what an official GitHub CLI tool can look like with a fundamentally different design. While both
3336
tools bring GitHub to the terminal, `hub` behaves as a proxy to `git` and `gh` is a standalone
34-
tool.
37+
tool. Check out our [more detailed explanation](/docs/gh-vs-hub.md) to learn more.
3538

3639

37-
## Installation and Upgrading
40+
<!-- this anchor is linked to from elsewhere, so avoid renaming it -->
41+
## Installation
3842

3943
### macOS
4044

45+
`gh` is available via Homebrew and MacPorts.
46+
47+
#### Homebrew
48+
4149
Install: `brew install github/gh/gh`
4250

43-
Upgrade: `brew update && brew upgrade gh`
51+
Upgrade: `brew upgrade gh`
52+
53+
#### MacPorts
54+
55+
Install: `sudo port install gh`
56+
57+
Upgrade: `sudo port selfupdate && sudo port upgrade gh`
4458

4559
### Windows
4660

@@ -80,9 +94,16 @@ MSI installers are available for download on the [releases page][].
8094
Install and upgrade:
8195

8296
1. Download the `.deb` file from the [releases page][]
83-
2. `sudo apt install git && sudo dpkg -i gh_*_linux_amd64.deb` install the downloaded file
97+
2. `sudo apt install ./gh_*_linux_amd64.deb` install the downloaded file
98+
99+
### Fedora Linux
100+
101+
Install and upgrade:
102+
103+
1. Download the `.rpm` file from the [releases page][]
104+
2. `sudo dnf install gh_*_linux_amd64.rpm` install the downloaded file
84105

85-
### Fedora/Centos Linux
106+
### Centos Linux
86107

87108
Install and upgrade:
88109

@@ -108,7 +129,7 @@ $ yay -S github-cli
108129

109130
Install a prebuilt binary from the [releases page][]
110131

111-
### [Build from source](/source.md)
132+
### [Build from source](/docs/source.md)
112133

113134
[docs]: https://cli.github.com/manual
114135
[scoop]: https://scoop.sh

0 commit comments

Comments
 (0)