From f09785a98fcc04196f1ab5ec44fe62ddf0a63431 Mon Sep 17 00:00:00 2001 From: andrewc Date: Tue, 24 Oct 2023 13:35:45 +1000 Subject: [PATCH] Fetch before getting branches --- kibot-ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kibot-ci.yml b/kibot-ci.yml index 0f9098f..60e2aea 100644 --- a/kibot-ci.yml +++ b/kibot-ci.yml @@ -111,6 +111,7 @@ image: if [[ $GITLAB_CI == 'true' && $CI_COMMIT_BRANCH == "main" ]]; then git config --global user.name "KicadCi" git config --global user.email "andrew@micromelon.com.au" + cd $CI_PROJECT_DIR for d in "libs/melonlib" "libs/melon3d" do cd $d @@ -120,13 +121,13 @@ image: else TOKEN=$KI_LIB_3D_TOKEN fi - SHA=$(git rev-parse HEAD) - CURR_B=$(git name-rev --name-only $SHA) + git fetch --all + CURR_B=$(git name-rev --name-only $(git rev-parse HEAD)) REPO=$(basename $(git remote get-url origin)) - git remote add gl_origin https://ci_push:$TOKEN@gitlab.com/Micromelon/education/hardware/$REPO - git checkout $CURR_B - git commit --allow-empty -m "Merge" echo $CURR_B + git checkout $CURR_B + git remote add gl_origin https://ci_push:$TOKEN@gitlab.com/Micromelon/education/hardware/$REPO + git commit --allow-empty -m "Merge" git remote get-url gl_origin git push gl_origin HEAD:$CURR_B -o merge_request.create -o merge_request.remove_source_branch=false -o merge_request.merge_when_pipeline_succeeds -o merge_request.target=master cd $CI_PROJECT_DIR