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.
This commit is contained in:
Fabio Manganiello 2023-08-07 00:10:46 +02:00
parent 2005bc9f62
commit 39fb3026bf
Signed by: blacklight
GPG Key ID: AD6D273C08B82EC9
1 changed files with 7 additions and 1 deletions

View File

@ -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