ci(aio): do not deploy PR if preconditions not met

This avoids incorrectly failing the build if the PR author is not a member of one of the whitelisted GitHub teams.
This commit is contained in:
Georgios Kalpakas
2017-03-07 11:39:37 +02:00
committed by Chuck Jazdzewski
parent 4ca772eea3
commit 174d4c8ef7
6 changed files with 176 additions and 53 deletions
+17 -2
View File
@@ -54,11 +54,26 @@ case ${CI_MODE} in
# This is a PR: deploy a snapshot for previewing
travisFoldStart "deploy.aio.pr-preview"
# Only deploy if this PR has touched relevant files.
AIO_CHANGED_FILES_COUNT=$(git diff --name-only $TRAVIS_COMMIT_RANGE | grep ^aio/ | wc -l)
readonly AIO_CHANGED_FILES_COUNT=$(git diff --name-only $TRAVIS_COMMIT_RANGE | grep ^aio/ | wc -l)
if [[ AIO_CHANGED_FILES_COUNT -eq 0 ]]; then
echo "Skipping deploy because this PR did not touch any files inside 'aio/'."
else
yarn run deploy-preview
# Only deploy if this PR meets certain preconditions.
readonly AIO_PREVERIFY_EXIT_CODE=$(./aio-builds-setup/scripts/travis-preverify-pr.sh && echo 0 || echo $?)
case $AIO_PREVERIFY_EXIT_CODE in
2)
# An error occurred: Fail the build
exit 1;
;;
1)
# Preconditions not met: Skip deploy
echo "Skipping deploy because this PR did not meet the preconditions."
;;
0)
# Preconditions met: Deploy
yarn run deploy-preview
;;
esac
fi
travisFoldEnd "deploy.aio.pr-preview"
else
+3
View File
@@ -77,6 +77,9 @@ if [[ ${TRAVIS:-} ]]; then
# WARNING: NGBUILDS_IO_KEY should NOT be printed
export NGBUILDS_IO_KEY=${NGBUILDS_IO_KEY:-$SAUCE_ACCESS_KEY}
# Personal token generated by mary-poppins, with only `read_org` permission
export GITHUB_TEAM_MEMBERSHIP_CHECK_KEY=35fc4093c1f29a2ddaf60cce5d57065454180bf6
# Used by karma and karma-chrome-launcher
# In order to have a meaningful SauceLabs badge on the repo page,
# the angular2-ci account is used only when pushing commits to master;