Skip to content

Commit

Permalink
Merge pull request #37 from stan-dev/rstan-submodule-updates
Browse files Browse the repository at this point in the history
Add update script for rstan submodule
  • Loading branch information
andrjohns authored Jan 22, 2025
2 parents 67582f0 + 941a4b1 commit e2eedc0
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions jenkins/create-rstan-pull-request.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

trap 'abort' 0

set -e

git checkout develop
git pull origin
git submodule update --init --recursive
pushd StanHeaders/inst/include/upstream > /dev/null
git checkout develop
git pull origin
popd > /dev/null
git submodule update --init --recursive

original_commit_hash=$(cd StanHeaders/inst/include/upstream && git rev-parse --short HEAD)
stan_commit_hash=$(cd StanHeaders/inst/include/upstream && git rev-parse --short origin/develop)


if [ "$original_commit_hash" == "$stan_commit_hash" ]; then
echo "------------------------------------------------------------"
echo ""
echo " No need to update. "
echo " Submodule at: ${original_commit_hash}."
echo " Update to: ${stan_commit_hash}."
echo ""
echo "------------------------------------------------------------"
echo ""
trap : 0
exit 0
fi

pushd StanHeaders/inst/include/upstream > /dev/null
git checkout ${stan_commit_hash}
popd > /dev/null
git add StanHeaders/inst/include/upstream
git commit -m "Updates the Stan submodule to ${stan_commit_hash}." stan
git push origin develop

trap : 0

echo "------------------------------------------------------------"
echo ""
echo " Success updating stan submodule to ${stan_commit_hash}"
echo ""
echo "------------------------------------------------------------"
echo ""

exit 0

0 comments on commit e2eedc0

Please sign in to comment.