Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fahadahammed/32c8c211b6892e889c7909b7f05e8e3d to your computer and use it in GitHub Desktop.
Save fahadahammed/32c8c211b6892e889c7909b7f05e8e3d to your computer and use it in GitHub Desktop.
tmpFile="/tmp/jenkinsgitlabrokomarifilechanges.txt"
# All the files that changed in this build trigger to a temporary file
git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT > $tmpFile
# Which file extension to catch
to_find=".js .scss .css"
count=0
for i in $(echo $to_find | sed 's| |\n|g');
do
if grep -q "$i" "$File";
then
echo "Got the files of type: \"*$i\"";
count=$(echo $count+1 | /usr/bin/bc);
else
echo "\"*$i\" Type Not Found";
fi
done
echo $count;
if [ "$count" -gt 0 ];
then
echo "Found more than 0: $count";
echo "Running NPM";
npm run build-production;
else
echo "Not Found";
echo "Not running NPM";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment