From 4d5f8fb87d73e4f9f4aa70ce884ee8499766a0a2 Mon Sep 17 00:00:00 2001 From: curben <2809763-curben@users.noreply.gitlab.com> Date: Wed, 1 Apr 2020 10:14:30 +0100 Subject: [PATCH] fix(status-badge): set git branch --- .gitlab-ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94752050..86ce9dc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,11 +29,13 @@ deploy_job: - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts + - git checkout master + - git config --global user.name "curben-bot" + - git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com" + # Generate successful status badge - mkdir -p .gitlab/ - wget https://img.shields.io/badge/pipeline-passed-success.svg -O .gitlab/status.svg - - git config --global user.name "curben-bot" - - git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com" - git add .gitlab/status.svg # Only commit when diff exists https://stackoverflow.com/a/8123841 - git diff-index --quiet HEAD || git commit -m "Success pipeline" @@ -69,10 +71,12 @@ failed_job: - chmod 644 ~/.ssh/known_hosts script: - - mkdir -p .gitlab/ - - wget https://img.shields.io/badge/pipeline-failed-critical.svg -O .gitlab/status.svg + - git checkout master - git config --global user.name "curben-bot" - git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com" + + - mkdir -p .gitlab/ + - wget https://img.shields.io/badge/pipeline-failed-critical.svg -O .gitlab/status.svg - git add .gitlab/status.svg - git diff-index --quiet HEAD || git commit -m "Failed pipeline" - ssh -T git@gitlab.com