gh issue コマンド
gh issue
コマンドは、issueの作成や閲覧することができます。
gh issue <command> [flags]
で実行し、<command>
には以下の6個が利用できます。
close: Close issue
create: Create a new issue
list: List and filter issues in this repository
reopen: Reopen issue
status: Show status of relevant issues
view: View an issue
gh issue create
gh issue create
コマンドは、issueを作成することができるコマンドです。
gh issue create [flags]
で実行する。
フラグ
以下のフラグが利用できます。
flags short | flags long | 説明 |
---|---|---|
-a | --assignee | assigneeを指定 |
-b | --body | bodyを指定 |
-l | --label | ラベルを指定 |
-m | --milestone | マイルストーンを指定 |
-p | --project | プロジェクトを指定 |
-t | --title | タイトルを指定 |
-w | --web | ブラウザで開く |
対話形式でissueを作成
まずはタイトルを指定します。
$ gh issue create
Creating issue in JIIOryo/foo
? Title hoge bug 🐛
e
を押すことで、エディタが開きます。
? Body [(e) to launch vim, enter to skip]
入力が完了。
? Body <Received>
? What's next? [Use arrows to move, type to filter]
> Submit
Continue in browser
Add metadata
Cancel
Add metadata
で、assigneeやlabelを指定することができます。移動は上下ボタン、選択はスペースキーです。確定はEnter。
? What would you like to add? [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
[ ] Assignees
> [x] Labels
[ ] Projects
[ ] Milestone
Labelを選択すると、以下のようにラベル一覧が表示されます。同様に移動は上下ボタン、選択はスペースキーです。確定はEnter。
? Labels [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
[x] bug
[ ] documentation
[ ] duplicate
> [ ] enhancement
[x] fuga
[ ] good first issue
[ ] help wanted
Submitしましょう。
? What's next? [Use arrows to move, type to filter]
> Submit
Cancel
https://github.com/JIIOryo/foo/issues/11
issueができたみたいなので、みてみます。
コマンドで一発でissueを作成する。
-t
でタイトル、-b
でbody、-l
でラベル、-m
でマイルストーンを選択してみました。
$ gh issue create -t 'fuga bug 🐛' -b 'fugafuga' -l hoge,fuga -m foo
Creating issue in JIIOryo/foo
https://github.com/JIIOryo/foo/issues/12
ちなみに、-w
オプションをつけるとissueを作成する画面がブラウザで開きます。
help
$ gh issue create --help
Create a new issue
USAGE
gh issue create [flags]
FLAGS
-a, --assignee login Assign people by their login
-b, --body string Supply a body. Will prompt for one otherwise.
-l, --label name Add labels by name
-m, --milestone name Add the issue to a milestone by name
-p, --project name Add the issue to projects by name
-t, --title string Supply a title. Will prompt for one otherwise.
-w, --web Open the browser to create an issue
INHERITED FLAGS
--help Show help for command
-R, --repo OWNER/REPO Select another repository using the OWNER/REPO format
EXAMPLES
$ gh issue create --title "I found a bug" --body "Nothing works"
$ gh issue create --label "bug,help wanted"
$ gh issue create --label bug --label "help wanted"
$ gh issue create --assignee monalisa,hubot
$ gh issue create --project "Roadmap"
LEARN MORE
Use 'gh <command> <subcommand> --help' for more information about a command.
Read the manual at https://cli.github.com/manual
gh issue list
gh issue list
コマンドは、issueの一覧を表示することができます。
gh issue list [flags]
で実行する。
フラグ
以下のフラグが利用できます。
flags short | flags long | 説明 |
---|---|---|
-a | --assignee | assigneeでフィルタリング |
-A | --author | authorでフィルタリング |
-l | --label | ラベルでフィルタリング |
-L | --limit | issueの最大表示件数を指定 (デフォルト30件) |
-m | --milestone | マイルストーンをでフィルタリング |
--mention | メンションでフィルタリング | |
-p | --project | プロジェクトを指定 |
-s | --state | 状態でフィルタリング open ,closed ,all が指定できます。(デフォルトopen ) |
-w | --web | ブラウザで開く |
例
$ gh issue list
Showing 2 of 2 open issues in JIIOryo/foo
#12 fuga bug 🐛 (fuga, hoge) about 5 minutes ago
#11 hoge bug 🐛 (bug, fuga, hoge) about 9 minutes ago
フラグを付けて検索してみます。
$ gh issue list -l hoge,fuga -L 1 -s all
Showing 1 of 2 issues in JIIOryo/foo that match your search
#12 fuga bug 🐛 (fuga, hoge) about 10 minutes ago
help
$ gh issue list --help
List and filter issues in this repository
USAGE
gh issue list [flags]
FLAGS
-a, --assignee string Filter by assignee
-A, --author string Filter by author
-l, --label strings Filter by labels
-L, --limit int Maximum number of issues to fetch (default 30)
--mention string Filter by mention
-m, --milestone number Filter by milestone number or `title`
-s, --state string Filter by state: {open|closed|all} (default "open")
-w, --web Open the browser to list the issue(s)
INHERITED FLAGS
--help Show help for command
-R, --repo OWNER/REPO Select another repository using the OWNER/REPO format
EXAMPLES
$ gh issue list -l "help wanted"
$ gh issue list -A monalisa
$ gh issue list --web
$ gh issue list --milestone 'MVP'
LEARN MORE
Use 'gh <command> <subcommand> --help' for more information about a command.
Read the manual at https://cli.github.com/manual
gh issue status
gh issue status
コマンドは、issueのステータスを表示するコマンドです。
gh issue status [flags]
で実行する。 自分がアサインされたissue, メンションされたissue, 自分が作成したissueを確認することができます。
例
$ gh issue status
Relevant issues in JIIOryo/foo
Issues assigned to you
#12 fuga bug 🐛 (fuga, hoge) less than a minute ago
Issues mentioning you
#12 fuga bug 🐛 (fuga, hoge) less than a minute ago
Issues opened by you
#12 fuga bug 🐛 (fuga, hoge) less than a minute ago
#11 hoge bug 🐛 (bug, fuga, hoge) about 3 hours ago
help
$ gh issue status --help
Show status of relevant issues
USAGE
gh issue status [flags]
INHERITED FLAGS
--help Show help for command
-R, --repo OWNER/REPO Select another repository using the OWNER/REPO format
LEARN MORE
Use 'gh <command> <subcommand> --help' for more information about a command.
Read the manual at https://cli.github.com/manual
gh issue close
gh issue close
コマンドは、issueをcloseすることができるコマンドです。
gh issue close {<number> | <url>} [flags]
で実行する。 issueを選択する方法は、issue番号
, issueのURL
の2つがあります。
例
$ gh issue close 12
✔ Closed issue #12 (fuga bug 🐛)
$ gh issue close https://github.com/JIIOryo/foo/issues/12
✔ Closed issue #12 (fuga bug 🐛)
help
$ gh issue close --help
Close issue
USAGE
gh issue close {<number> | <url>} [flags]
INHERITED FLAGS
--help Show help for command
-R, --repo OWNER/REPO Select another repository using the OWNER/REPO format
LEARN MORE
Use 'gh <command> <subcommand> --help' for more information about a command.
Read the manual at https://cli.github.com/manual
gh issue reopen
gh issue reopen
コマンドは、closeしたissueを再び開くコマンドです。
gh issue reopen {<number> | <url>} [flags]
で実行します。 issueを選択する方法は、issue番号
, issueのURL
の2つがあります。
$ gh issue reopen 12
✔ Reopened issue #12 (fuga bug 🐛)
$ gh issue reopen https://github.com/JIIOryo/foo/issues/12
✔ Reopened issue #12 (fuga bug 🐛)
help
$ gh issue reopen --help
Reopen issue
USAGE
gh issue reopen {<number> | <url>} [flags]
INHERITED FLAGS
--help Show help for command
-R, --repo OWNER/REPO Select another repository using the OWNER/REPO format
LEARN MORE
Use 'gh <command> <subcommand> --help' for more information about a command.
Read the manual at https://cli.github.com/manual
gh issue view
gh issue view
コマンドは、issueを閲覧することができるコマンドです。
gh issue view {<number> | <url>} [flags]
で実行する。 issueを選択する方法は、issue番号
, issueのURL
の2つがあります。
フラグ
以下のフラグが利用できます。
flags short | flags long | 説明 |
---|---|---|
-w | --web | ブラウザで開く |
例
$ gh issue view 11
$ gh issue view https://github.com/JIIOryo/foo/issues/11
markdownがしっかり認識されて色付けされていてみやすいですが、ブラウザでしっかり確認したい場合もあります。
そのような場合は-w
オプションを利用します。
$ gh issue view 11 -w
Opening github.com/JIIOryo/foo/issues/11 in your browser.
help
$ gh issue view --help
Display the title, body, and other information about an issue.
With '--web', open the issue in a web browser instead.
USAGE
gh issue view {<number> | <url>} [flags]
FLAGS
-w, --web Open an issue in the browser
INHERITED FLAGS
--help Show help for command
-R, --repo OWNER/REPO Select another repository using the OWNER/REPO format
LEARN MORE
Use 'gh <command> <subcommand> --help' for more information about a command.
Read the manual at https://cli.github.com/manual