Skip snap build for PRs if nothing under snap/ is modified

Additionally relegate push snap build to a secondary CI pipeline
This commit is contained in:
Michael Vines
2018-06-30 19:22:24 -07:00
committed by Grimes
parent 5671da4a0a
commit 71af03dc98
5 changed files with 39 additions and 7 deletions

18
ci/pr-snap.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash -e
#
# Only run snap.sh for pull requests that modify files under /snap
#
cd "$(dirname "$0")"
if ./is-pr.sh; then
affected_files="$(buildkite-agent meta-data get affected_files)"
echo "Affected files in this PR: $affected_files"
if [[ ! ":$affected_files:" =~ :snap/ ]]; then
echo "Skipping snap build as no files under /snap were modified"
exit 0
fi
exec ./snap.sh
else
echo "Skipping snap build as this is not a pull request"
fi