LoginSignup
0
0

More than 3 years have passed since last update.

GitHub PullRequest の comment を全削除する shell function

Posted at

zshrc とか bashrc とかに書いておいて

function delete_pr_comments() {
  owner=$1
  repo=$2
  prnum=$3
  geturl="https://api.github.com/repos/${owner}/${repo}/issues/${prnum}/comments"
  deleteurl="https://api.github.com/repos/${owner}/${repo}/issues/comments/"
  curl -s -H "Authorization: token ${GITHUB_TOKEN}" "${geturl}" | \
    jq '.[].id' | \
    xargs -I{} curl -s -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" "${deleteurl}"{}
}

Run

$ cat .envrc
export GITHUB_TOKEN="keep-your-github-token-secret"

$ delete_pr_comments chaspy example-repository 1111

便利。

ref: https://developer.github.com/v3/issues/comments/#update-an-issue-comment

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0