From 43875641ea754a04e72c42098cd82be8d46e868b Mon Sep 17 00:00:00 2001 From: Ilia Kebets <104737176+ilia-kebets-sonarsource@users.noreply.github.com> Date: Fri, 17 Mar 2023 14:38:24 +0100 Subject: [PATCH] Create PR check for uncommitted transpiled code (#24) --- .cirrus.yml | 9 +++++++++ scripts/check-committed.sh | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .cirrus.yml create mode 100755 scripts/check-committed.sh diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 00000000..8534a312 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,9 @@ +container: + image: node:latest + +apply_changes_and_check_task: + apply_changes_and_check_script: + - npm run build + # the check-committed.sh script should always be executed last + - ./scripts/check-committed.sh + diff --git a/scripts/check-committed.sh b/scripts/check-committed.sh new file mode 100755 index 00000000..f2792721 --- /dev/null +++ b/scripts/check-committed.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +# Inspired by https://stackoverflow.com/a/5139346 + +uncommitted_changes="$(git status --porcelain)" + +if [ -n "$uncommitted_changes" ]; then + echo "There are some uncommitted changes" + echo "$uncommitted_changes" + exit 1; +else + exit 0; +fi