@@ -28,17 +28,22 @@ COMMON_PATTERNS=(
28
28
" version.properties"
29
29
)
30
30
31
+ # Define constants for job types
32
+ VALIDATION=" validation"
33
+ BUILD=" build"
34
+ LINT=" lint"
35
+
31
36
# Check if arguments are valid
32
37
if [ -z " ${1:- } " ] || [ " $1 " != " --job-type" ] || [ -z " ${2:- } " ]; then
33
- echo " Error: Must specify --job-type [validation|build|lint ]"
38
+ echo " Error: Must specify --job-type [$VALIDATION | $BUILD | $LINT ]"
34
39
buildkite-agent step cancel
35
40
exit 15
36
41
fi
37
42
38
43
# Function to display skip message and create annotation
39
44
show_skip_message () {
40
45
local job_type=$1
41
- local message=" Skipping ${BUILDKITE_LABEL:- Job} - no relevant files changed"
46
+ local message=" Skipped ${BUILDKITE_LABEL:- Job} - no relevant files changed"
42
47
local context=" skip-$( echo " ${BUILDKITE_LABEL:- $job_type } " | sed -E -e ' s/[^[:alnum:]]+/-/g' | tr A-Z a-z) "
43
48
44
49
echo " $message " | buildkite-agent annotate --style " info" --context " $context "
@@ -47,7 +52,7 @@ show_skip_message() {
47
52
48
53
job_type=" $2 "
49
54
case " $job_type " in
50
- " validation " )
55
+ $VALIDATION )
51
56
# We should skip if changes are limited to documentation, tooling, non-code files, and localization files
52
57
PATTERNS=(" ${COMMON_PATTERNS[@]} " " **/strings.xml" )
53
58
if pr_changed_files --all-match " ${PATTERNS[@]} " ; then
@@ -56,7 +61,7 @@ case "$job_type" in
56
61
fi
57
62
exit 1
58
63
;;
59
- " build " | " lint " )
64
+ $BUILD | $LINT )
60
65
# We should skip if changes are limited to documentation, tooling, and non-code files
61
66
# We'll let the job run (won't skip) if PR includes changes in localization files though
62
67
PATTERNS=(" ${COMMON_PATTERNS[@]} " )
@@ -67,7 +72,7 @@ case "$job_type" in
67
72
exit 1
68
73
;;
69
74
* )
70
- echo " Error: Job type must be either 'validation ', 'build ', or 'lint '"
75
+ echo " Error: Job type must be either '$VALIDATION ', '$BUILD ', or '$LINT '"
71
76
buildkite-agent step cancel
72
77
exit 15
73
78
;;
0 commit comments