Auto detect github target branch in rebase script (#6187)

pull/6208/head
Florian Ruynat 2020-05-28 21:37:15 +02:00 committed by GitHub
parent 45d8797dce
commit 71d476b121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -1,9 +1,15 @@
#!/bin/bash
set -euxo pipefail
# Rebase PRs on master to get latest changes
KUBESPRAY_NEXT_VERSION=2.$(( ${KUBESPRAY_VERSION:3:2} + 1 ))
# Rebase PRs on master (or release branch) to get latest changes
if [[ $CI_COMMIT_REF_NAME == pr-* ]]; then
git config user.email "ci@kubespray.io"
git config user.name "CI"
git pull --rebase origin master
if [[ -z "`git branch -a --list origin/release-$KUBESPRAY_NEXT_VERSION`" ]]; then
git pull --rebase origin master
else
git pull --rebase origin release-$KUBESPRAY_NEXT_VERSION
fi
fi