Skip to content

Instantly share code, notes, and snippets.

@Gowiem
Created August 6, 2020 00:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gowiem/4c6fd3e2a60b922fe9f0627016d01fdc to your computer and use it in GitHub Desktop.
Save Gowiem/4c6fd3e2a60b922fe9f0627016d01fdc to your computer and use it in GitHub Desktop.
#!/bin/bash
GITHUB_USERNAME=Gowiem
MINS_AGO=$(date -v-30M -u +"%Y-%m-%dT%H:%M:%SZ")
PRS_CREATED_RECENTLY=$(curl -u $GITHUB_USERNAME:$GITHUB_API_TOKEN \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/issues?since=$MINS_AGO&per_page=100")
PR_URLS=($(echo $PRS_CREATED_RECENTLY | jq -r ".[].pull_request.url | @sh"))
for i in "${PR_URLS[@]}"; do
url=$(echo "$i" | sed "s/pulls/issues/g" | sed "s/'$/\/comments/" | sed "s/'//g")
echo "URL: $url"
curl \
-X POST \
-u $GITHUB_USERNAME:$GITHUB_API_TOKEN \
-H "Accept: application/vnd.github.v3+json" \
$url \
-d '{"body":"/test all"}'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment