Skip to content

Instantly share code, notes, and snippets.

@turusuke
Created November 20, 2017 14:42
Show Gist options
  • Save turusuke/dd4be13b20b2bfb8ea5dece18d56bb2e to your computer and use it in GitHub Desktop.
Save turusuke/dd4be13b20b2bfb8ea5dece18d56bb2e to your computer and use it in GitHub Desktop.
#!/bin/zsh
# Usage ./get-pr-review.sh :number(ex.120)
# dependencies jq -> https://stedolan.github.io/jq/
# {
# "user": "turusuke",
# "filePath": "main.js:14",
# "body": "いいと思います!",
# "arg": "https://github.com/owner/repo/pull/540#discussion_11111"
# }
# TOKENKEY TEXT FILE
# https://github.com/settings/tokens/new -> repo
apikey=`cat ~/apikey.txt`
# Request URL
url=https://github.com/api/v3/repos/:owner/:repo/pulls/$1/comments\?access_token\=$apikey
# Object
object='[.[] | {user: .user.login ,filePath: "\(.path):\(.position)", body: .body, arg: ._links.html.href}]'
# 実行
curl -s $url | jq $object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment