2 # Set the SKIP_JOB environment variable if this job is supposed to only run
3 # when submodules are updated and they were not. The following time consuming
4 # tasks will be skipped when the environment variable is present.
9 source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
11 if [[ -z "${CI_ONLY_WHEN_SUBMODULES_CHANGED+x}" ]]; then
12 echo "Executing the job since there is no skip rule in effect"
13 elif git diff HEAD^ | grep --quiet "^index .* 160000"; then
14 # Submodules pseudo-files inside git have the 160000 permissions, so when
15 # those files are present in the diff a submodule was updated.
16 echo "Executing the job since submodules are updated"
17 elif git diff --name-only HEAD^ | grep --quiet src/tools/clippy; then
18 # There is not an easy blanket search for subtrees. For now, manually list
20 echo "Executing the job since clippy subtree was updated"
22 echo "Not executing this job since no submodules were updated"
23 ciCommandSetEnv SKIP_JOB 1