Skip to content

Commit

Permalink
Merge commit 'refs/pull/108/head' of github.com:whiteinge/ok.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
whiteinge committed Oct 30, 2020
2 parents b5cb051 + ced330d commit acf5159
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ Flags _must_ be the first argument to `ok.sh`, before `command`.
* [upload_asset](#upload_asset)
* [list_milestones](#list_milestones)
* [create_milestone](#create_milestone)
* [list_issue_comments](#list_issue_comments)
* [add_comment](#add_comment)
* [list_commit_comments](#list_commit_comments)
* [add_commit_comment](#add_commit_comment)
* [close_issue](#close_issue)
* [list_issues](#list_issues)
Expand Down Expand Up @@ -1337,6 +1339,26 @@ Milestone options may also be passed as keyword arguments:
* `due_on`
* `state`

### list_issue_comments

List comments of a specified issue.
( https://developer.github.com/v3/issues/comments/#list-issue-comments )

Usage:

list_issue_comments someuser/somerepo number

Positional arguments

GitHub owner login or id for which to list branches
Name of the repo for which to list branches
Issue number

* `repo="$1"`

* `number="$2"`


### add_comment

Add a comment to an issue
Expand All @@ -1363,6 +1385,26 @@ Keyword arguments

A jq filter to apply to the return data.

### list_commit_comments

List comments of a specified commit.
( https://developer.github.com/v3/repos/comments/#list-commit-comments )

Usage:

list_commit_comments someuser/somerepo sha

Positional arguments

GitHub owner login or id for which to list branches
Name of the repo for which to list branches
Commit SHA

* `repo="$1"`

* `sha="$2"`


### add_commit_comment

Add a comment to a commit
Expand Down
83 changes: 83 additions & 0 deletions ok.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2046,6 +2046,47 @@ create_milestone() {
| _filter_json "$_filter"
}
list_issue_comments() {
# List comments of a specified issue.
# ( https://developer.github.com/v3/issues/comments/#list-issue-comments )
#
# Usage:
#
# list_issue_comments someuser/somerepo number
#
# Positional arguments
#
# GitHub owner login or id for which to list branches
# Name of the repo for which to list branches
# Issue number
#
local repo="${1:?Repo name required.}"
local number="${2:?Issue number is required.}"
shift 2
local _follow_next
# Automatically look for a 'Links' header and follow any 'next' URLs.
local _follow_next_limit
# Maximum number of 'next' URLs to follow before stopping.
local _filter='.[] | "\(.body)"'
# A jq filter to apply to the return data.
_opts_pagination "$@"
# A jq filter to apply to the return data.
#
# Querystring arguments may also be passed as keyword arguments:
#
# * `direction`
# * `sort`
# * `since`
local qs
_opts_filter "$@"
_opts_qs "$@"
url="/repos/${repo}/issues/${number}/comments"
_get "${url}${qs}" | _filter_json "${_filter}"
}
add_comment() {
# Add a comment to an issue
#
Expand Down Expand Up @@ -2075,6 +2116,48 @@ add_comment() {
| _filter_json "${_filter}"
}
list_commit_comments() {
# List comments of a specified commit.
# ( https://developer.github.com/v3/repos/comments/#list-commit-comments )
#
# Usage:
#
# list_commit_comments someuser/somerepo sha
#
# Positional arguments
#
# GitHub owner login or id for which to list branches
# Name of the repo for which to list branches
# Commit SHA
#
local repo="${1:?Repo name required.}"
local sha="${2:?Commit SHA is required.}"
shift 2
local _follow_next
# Automatically look for a 'Links' header and follow any 'next' URLs.
local _follow_next_limit
# Maximum number of 'next' URLs to follow before stopping.
local _filter='.[] | "\(.body)"'
# A jq filter to apply to the return data.
_opts_pagination "$@"
# A jq filter to apply to the return data.
#
# Querystring arguments may also be passed as keyword arguments:
#
# * `direction`
# * `sort`
# * `since`
local qs
_opts_filter "$@"
_opts_qs "$@"
url="/repos/${repo}/commits/${sha}/comments"
_get "${url}${qs}" | _filter_json "${_filter}"
}
add_commit_comment() {
# Add a comment to a commit
#
Expand Down

0 comments on commit acf5159

Please sign in to comment.