From c678b73675e1d2bf3be6042bed920e27d3d62490 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Mon, 13 Aug 2018 18:03:14 +0200 Subject: [PATCH] Fix Semaphore stable branch detection --- semaphoreci.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/semaphoreci.sh b/semaphoreci.sh index 50c94948148d..a209005f86eb 100755 --- a/semaphoreci.sh +++ b/semaphoreci.sh @@ -19,8 +19,7 @@ export OS_NAME=linux export FULL_BUILD="${PULL_REQUEST_NUMBER+false}" # SemaphoreCI doesn't provide a convenient way to the base branch (e.g. master or stable) if [ -n "${PULL_REQUEST_NUMBER:-}" ]; then - # detect master/stable without querying the rate-limited API - BRANCH="$(git describe --all | sed -E "s/.*\/([^-/]*)-.*/\1/")" + BRANCH=$((curl -fsSL https://api.github.com/repos/dlang/dmd/pulls/$PULL_REQUEST_NUMBER || echo) | jq -r '.base.ref') # check if the detected branch actually exists and fallback to master if ! git ls-remote --exit-code --heads https://github.com/dlang/dmd.git "$BRANCH" > /dev/null ; then echo "Invalid branch detected: ${BRANCH} - falling back to master"