From 66c361d3ac5ed0f70ef216403d825dd28ab5c43b Mon Sep 17 00:00:00 2001 From: AzaharaC Date: Wed, 15 Sep 2021 10:13:04 +0200 Subject: [PATCH] feat(ci): skip check when only documentation files #1014 Signed-off-by: AzaharaC --- tools/ci.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/ci.sh b/tools/ci.sh index 54fbac8a5a6..3cbf9a37df3 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -39,6 +39,25 @@ function dumpDiskUsageInfo() fi } +function checkOnlyDocumentation() +{ + z=0 + + for i in $CHANGED_FILES; do + z=$((z+1)) + if [ ${i: -3} != ".md" ]; then + break + elif [ ${i: -3} == ".md" ] && [ $(echo ${CHANGED_FILES} | wc -l) == $z ]; then + echo 'There are only changes in the documentation files.' + ENDED_AT=`date +%s` + runtime=$((ENDED_AT-STARTED_AT)) + echo "$(date +%FT%T%z) [CI] SUCCESS - runtime=$runtime seconds." + checkWorkTreeStatus + exit 0 + fi + done +} + function mainTask() { set -euxo pipefail @@ -61,6 +80,9 @@ function mainTask() smem --abbreviate --totals --system || true fi + # Check if the modified files are only for documentation. + checkOnlyDocumentation + dumpDiskUsageInfo # If we are running in a GitHub Actions runner, then free up 30 GB space by