Skip to content

Instantly share code, notes, and snippets.

@atz
Last active March 31, 2018 01:14
Show Gist options
  • Save atz/0ea6f27968cbc0f4f6213657a9b900a7 to your computer and use it in GitHub Desktop.
Save atz/0ea6f27968cbc0f4f6213657a9b900a7 to your computer and use it in GitHub Desktop.
Plow through enumerated ruby apps, update gems and create PRs
#!/bin/bash
#
# requires Github CLI extensions (`hub`)
# Hub w/ multifactor authentication requires 4 lines in ~/.config/hub like:
# ---
# github.com:
# - oauth_token: SOME_TOKEN_STRING
# user: atz
#
# Get the token string from a new token here: https://github.com/settings/tokens
#
# Repo FAILS:
# - dor-services-app: requires Oracle libs for ruby-oci8
# - dor-workflow-service: Gemfile.lock is ignored
mkdir -vp $TMPDIR/.autoupdate
# for i in purl stacks sul-embed purl-fetcher content_search course_reserves discovery-dispatcher earthworks exhibits library_hours_rails sul-bento-app sul-directory sul-requests sw-indexer SearchWorks revs dlme arclight-demo vatican_exhibits revs-indexer-service bassi_veratti editstore-updater portfolios mods_display_app mirador_sul; do
for i in argo assembly dor_indexing_app harvestdor-indexer hydra_etd hydrus modsulator-app pre-assembly robot-master suri_rails sul_pub gis-robot-suite was-thumbnail-service sdr-preservation-core sdr-services-app goobi-robot etd-robots common-accessioning dor-scripts workflow-archiver-job was-registrar purl-fetcher dor-fetcher-service was_robot_suite; do
# for i in systems-dashboard sul-solr-configs quimby; do
echo $i
cd $TMPDIR/.autoupdate
git ls-remote --heads --exit-code git@github.com:sul-dlss/$i.git update-dependencies
if [[ $? -eq 0 ]] ; then
echo "Skipping $i: update-dependencies branch already exists on remote repo"
continue
fi
git clone git@github.com:sul-dlss/$i
cd $TMPDIR/.autoupdate/$i
git fetch origin
git checkout -B update-dependencies origin/master
bundle update &&
git add Gemfile.lock &&
git commit -m "Update dependencies" &&
git push origin update-dependencies &&
hub pull-request -f -m "Update dependencies"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment