Last active
May 9, 2019 16:22
-
-
Save robinmitra/e0b2f8f188ca8432dc7381e6ea5770ab to your computer and use it in GitHub Desktop.
Post comment on multiple Pull Requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
GITHUB_USERNAME=<username> | |
GITHUB_ACCESS_TOKEN=<access-token> | |
REPO_URL=https://api.github.com/repos/<repo-owner>/<repo> | |
PR_BASE_URL=${REPO_URL}/pulls | |
COMMENT_BASE_URL=${REPO_URL}/issues | |
open_pr_ids=$(curl -u ${GITHUB_USERNAME}:${GITHUB_ACCESS_TOKEN} \ ${PR_BASE_URL}?state=open \ | |
| jq -r '[.[] | .number] | join(" ")') | |
for id in ${open_pr_ids}; do | |
curl \ | |
-u ${GITHUB_USERNAME}:${GITHUB_ACCESS_TOKEN} ${COMMENT_BASE_URL}/${id}/comments \ | |
-d '{"body": "PR updated"}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment