Skip to content

Commit 39fd768

Browse files
author
Gaurav Nelson
committed
Only run the autopreview logic on pull requests
1 parent 1e39f10 commit 39fd768

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

autopreview.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ set -ev
33

44
#ALLOWED_USERS=("aireilly" "mburke5678" "vikram-redhat" "abrennan89" "ahardin-rh" "kalexand-rh" "adellape" "bmcelvee" "ousleyp" "lamek" "JStickler" "rh-max" "bergerhoffer" "sheriff-rh" "jboxman" "bobfuru" "aburdenthehand" "boczkowska" "Preeticp" "neal-timpe" "codyhoag" "apinnick" "bgaydosrh" "lmandavi" "maxwelldb" "pneedle-rh" "lbarbeevargas" "jeana-redhat" "RichardHoch" "johnwilkins" "sjhala-ccs" "mgarrellRH" "SNiemann15" "sfortner-RH" "jonquilwilliams" "ktania46" "wking" "
55
#jc-berger" "rishumehra" "iranzo" "abhatt-rh" "@mohit-sheth" "stoobie" "emarcusRH" "kquinn1204" "mikemckiernan" "skrthomas" "sagidlow" "rolfedh")
6-
USERNAME=${TRAVIS_PULL_REQUEST_SLUG::-15}
7-
COMMIT_HASH="$(git rev-parse @~)"
8-
mapfile -t FILES_CHANGED < <(git diff --name-only "$COMMIT_HASH")
96

107
if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then #to make sure it only runs on PRs and not all merges
8+
USERNAME=${TRAVIS_PULL_REQUEST_SLUG::-15}
9+
COMMIT_HASH="$(git rev-parse @~)"
10+
mapfile -t FILES_CHANGED < <(git diff --name-only "$COMMIT_HASH")
11+
1112
if [ "${TRAVIS_PULL_REQUEST_BRANCH}" != "main" ] ; then # to make sure it does not run for direct main changes
1213
if [[ " ${FILES_CHANGED[*]} " = *".adoc"* ]] || [[ " ${FILES_CHANGED[*]} " = *"_topic_map.yml"* ]] || [[ " ${FILES_CHANGED[*]} " = *"_distro_map.yml"* ]] ; then # to make sure this doesn't run for general modifications
1314
if [ "$USERNAME" != "openshift-cherrypick-robot" ] ; then # to make sure it doesn't run for USERNAME openshift-cherrypick-robot

0 commit comments

Comments
 (0)