From 39fb3026bf64d68ca5738aa18639e10d5370bef0 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 7 Aug 2023 00:10:46 +0200 Subject: [PATCH] Prevent push loops in build-ui pipeline. The pipeline should check if the latest commit is an automated UI build commit before proceeding with a new build. We need this check in place to prevent pipelines triggered by a push in another pipeline that end up triggering other pipelines until a manual cancel. --- .drone.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 6067760a5..974df2a42 100644 --- a/.drone.yml +++ b/.drone.yml @@ -105,6 +105,12 @@ steps: exit 0 fi + - | + if [ "$(git log --pretty=format:%s HEAD...HEAD~1)" == "[Automatic] Updated UI files" ]; then + echo "UI changes have already been committed, skipping build" + exit 0 + fi + - rm -rf node_modules dist - npm install - npm run build @@ -129,9 +135,9 @@ steps: - chmod 0600 ~/.ssh/id_rsa - ssh-keyscan git.platypush.tech >> ~/.ssh/known_hosts 2>/dev/null - - git config --global commit.gpgsign true - git config user.name "Platypush CI/CD Automation" - git config user.email "admin@platypush.tech" + - git config commit.gpgsign true - git config user.signingkey $PGP_KEY_ID - git add dist - git commit dist -S -m "[Automatic] Updated UI files" --no-verify