Skip to content

Instantly share code, notes, and snippets.

@rpau
Last active April 22, 2025 12:19
Show Gist options
  • Select an option

  • Save rpau/a604b097bdf33fa69799df0a5a393e1e to your computer and use it in GitHub Desktop.

Select an option

Save rpau/a604b097bdf33fa69799df0a5a393e1e to your computer and use it in GitHub Desktop.
#!/bin/bash
export $BB_HOST="bitbucket.org"
export $PROJECT="REPLACE_ACME_PROJECT"
export $SLUG="REPLACE_ACME_REPO"
export $ACCESS_TOKEN="REPLACE_ACCESS_TOKEN"
advisor build-config get
advisor upgrade-plan apply
if [ $(git status --porcelain | wc -l) -eq "0" ]; then
echo " Git repo is clean."
else
if [ `git branch --list advisor` ]
then
echo "Pending changes to upgrade"
else
git checkout -b advisor
git add .
git commit -m "[Spring Application Advisor] Spring upgrade"
git push --set-upstream origin advisor
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/$PROJECT/$SLUG/pullrequests -d '{"title": "advisor upgrade" , "source": { "branch": { "name": "advisor" }}}'
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment