From 8a434d8410e096d6efeee6b4dc083003224e14a7 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Mon, 24 Jun 2024 10:04:09 +0200 Subject: [PATCH] Use newest branch if we have multiple matches. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a07e7c..7dff899 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ stages: - "*/build" before_script: - echo -n $CI_REGISTRY_PASSWORD | podman login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY - - git switch $(git branch -r --contains $CI_COMMIT_SHA | sed -e 's#[^/]*/##') + - git switch $(git branch -r --sort="authordate" --contains $CI_COMMIT_SHA | head -1 | sed -e 's#[^/]*/##') - git pull - git reset --hard $CI_COMMIT_SHA