diff --git a/make/test.mk b/make/test.mk index 28ae962d..cf8768a8 100644 --- a/make/test.mk +++ b/make/test.mk @@ -96,18 +96,17 @@ ifeq ($(E2E_REPO_PATH),"") git clone https://github.com/codeready-toolchain/toolchain-e2e.git ${E2E_REPO_PATH} ifneq ($(CI),) ifneq ($(GITHUB_ACTIONS),) - $(eval BRANCH_REF = refs/heads/${GITHUB_HEAD_REF}) + $(eval BRANCH_NAME = ${GITHUB_HEAD_REF}) $(eval AUTHOR_LINK = https://github.com/${AUTHOR}) else $(eval AUTHOR_LINK = $(shell jq -r '.refs[0].pulls[0].author_link' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]')) - @echo "using pull sha ${PULL_PULL_SHA}" - # get branch ref of the fork the PR was created from - $(eval BRANCH_REF := $(shell curl ${AUTHOR_LINK}/member-operator.git/info/refs?service=git-upload-pack --output - /dev/null 2>&1 | grep -a ${PULL_PULL_SHA} | awk '{print $$2}')) + @echo "found author link ${AUTHOR_LINK}" + $(eval BRANCH_NAME := $(shell jq -r '.refs[0].pulls[0].head_ref' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]')) endif @echo "using author link ${AUTHOR_LINK}" @echo "detected branch ref ${BRANCH_REF}" # check if a branch with the same ref exists in the user's fork of toolchain-e2e repo - $(eval REMOTE_E2E_BRANCH := $(shell curl ${AUTHOR_LINK}/toolchain-e2e.git/info/refs?service=git-upload-pack --output - 2>/dev/null | grep -a "${BRANCH_REF}$$" | awk '{print $$2}')) + $(eval REMOTE_E2E_BRANCH := $(shell curl ${AUTHOR_LINK}/toolchain-e2e.git/info/refs?service=git-upload-pack --output - 2>/dev/null | grep -a "refs/heads/${BRANCH_NAME}$$" | awk '{print $$2}')) @echo "branch ref of the user's fork: \"${REMOTE_E2E_BRANCH}\" - if empty then not found" # check if the branch with the same name exists, if so then merge it with master and use the merge branch, if not then use master if [[ -n "${REMOTE_E2E_BRANCH}" ]]; then \