Skip to content

Instantly share code, notes, and snippets.

@varhub
Last active August 29, 2015 14:15
Show Gist options
  • Save varhub/38c601b52a86abe187f0 to your computer and use it in GitHub Desktop.
Save varhub/38c601b52a86abe187f0 to your computer and use it in GitHub Desktop.
JdeRobot issue population (2/2): script for push previous generated issues.
#!/bin/sh
set -e
# Change it to fit your repository!
GITHUB_USER=varhub
GITHUB_REPO=JdeRobot
TWICE=$1
set -u
# retrive **ghi** client
curl -sL https://raw.githubusercontent.com/stephencelis/ghi/master/ghi > ghi && chmod 755 ghi
# setup our repository as upstream (all operations will be done here by default).
./ghi config ghi-repo $GITHUB_USER/$GITHUB_REPO
# request an auth token for ghi application
echo 'Now your passworkd will be asked to create an application token.
Please, remember to revoke it at here:
https://github.com/settings/applications
ALSO, this must me done ONCE. So comment me if you run it several times'
[ "$TWICE" = "twice" ] || ./ghi config --auth $GITHUB_USER # execute me once!!
# upload process
N=1
cat git.upload| while read issue
do
./ghi open -m "$issue" -- $GITHUB_USER/$GITHUB_REPO
./ghi close $N
N=$((N+1))
# There is a limit of 20 uses per minutes (Abuse Terms). See <https://github.com/octokit/octokit.net/issues/638> and <https://developer.github.com/v3/#abuse-rate-limits>
# So we need to wait 3 seconds at least to avoid to reach it OR create new token.
#sleep 3.250
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment