#!/usr/bin/env bash
## PR base check script for CircleCI
##
## Copyright (c) 2012-2014 Sylvain Benner
## Copyright (c) 2014-2018 Sylvain Benner & Contributors
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
## This file is not part of GNU Emacs.
## License: GPLv3
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/shared"
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "Skipping PR check for branch update."
exit 0
fi
pr_base=$(curl -s "${pr_data_URL}" | jq '.base.ref')
if [[ "${pr_base}" == "\"develop\"" ]]; then
echo "You are PRing to the develop branch. This is good."
elif [[ "${pr_base}" == "\"master\"" ]]; then
printf '=%.0s' {1..80}
printf "\n し(*・∀・)/ Thanks for the contribution! \(・∀・*)ノ\n"
printf "\n( ^◡^)っ Please submit your PR against the develop branch.\n"
echo "You can read the contribution guidelines at:"
echo "https://github.com/syl20bnr/spacemacs/blob/develop/CONTRIBUTING.org"
exit 2
else
echo_headline "Your PR has unrecognized base: \"${pr_base}\""