Skip to content

Instantly share code, notes, and snippets.

@tzmfreedom
Created January 27, 2020 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzmfreedom/4080d1499ce8bca08c9e134386494d2c to your computer and use it in GitHub Desktop.
Save tzmfreedom/4080d1499ce8bca08c9e134386494d2c to your computer and use it in GitHub Desktop.
bundle_update
#!/bin/bash
set -ue
git checkout master
current_branch=`git rev-parse --abbrev-ref HEAD`
if [[ ${current_branch} != master ]]; then
echo "Error: current branch is ${current_branch}"
exit 1
fi
branch=bundle-update_`date "+%Y%m%d"`
message="bundle update at $(date '+%Y/%m/%d')"
git fetch origin
git merge origin/master
git checkout -b ${branch}
bundle update
git add Gemfile.lock
git commit -m "${message}"
git push origin ${branch}
body=$(
bundle exec compare-linker-wrapper "./Gemfile.lock" \
--base origin/master \
--formatter CompareLinker::Formatter::Markdown
)
bundle exec pull-request-create create \
--title "${message}" \
--body "${body}" \
--head "${branch}"
git checkout master
git branch -D "${branch}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment