Skip to content

Instantly share code, notes, and snippets.

@idesaku
Last active December 28, 2015 18:09
Show Gist options
  • Save idesaku/7540801 to your computer and use it in GitHub Desktop.
Save idesaku/7540801 to your computer and use it in GitHub Desktop.
bundle update automation helper Create a pull request if any updates are there.
#!/bin/sh
OWNER="owner name"
REPO="repo name"
OAUTH_TOKEN="your oauth token"
git checkout master
git pull --rebase
bundle update
git diff --exit-code Gemfile.lock > /dev/null 2>&1
if [ "$?" = "0" ]; then
exit 0
fi
topic_branch_name="`date +%Y%m%d%H%M%S`_bundle_update"
git checkout -b $topic_branch_name
git commit -am 'bundle update'
git push origin $topic_branch_name
curl --fail --data-ascii "{
\"title\": \"bundle update\",
\"head\": \"$topic_branch_name\",
\"base\": \"master\"
}" \
-H "Authorization: token $OAUTH_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/pulls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment