diff --git a/cascading-pr.sh b/cascading-pr.sh index d45c9df..9c0e768 100755 --- a/cascading-pr.sh +++ b/cascading-pr.sh @@ -33,6 +33,13 @@ function default_branch() { jq --raw-output .default_branch < $TMPDIR/$direction.json } +function updated_at() { + local direction=$1 + + repo_curl ${options[${direction}_repo]} api_json ${options[${direction}_api]} > $TMPDIR/$direction.json + jq --raw-output .updated_at < $TMPDIR/$direction.json +} + function exists_branch() { local direction=$1 @@ -218,8 +225,10 @@ function push() { cd $TMPDIR/$direction git add . if git commit -m 'cascading-pr update'; then + local updated_at=$(updated_at $direction) git push --force ${remote} prbranch:$branch git rev-parse HEAD > ../$direction.sha + retry test "$updated_at" != "$(updated_at $direction)" log_info "pushed" else log_info "nothing to push"