This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/.circleci/PR_base
2017-09-24 21:42:11 +03:00

43 lines
1.3 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
## PR base check script for CircleCI
##
## Copyright (c) 2012-2014 Sylvain Benner
## Copyright (c) 2014-2017 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_data_URL="https://api.github.com/repos/"
pr_data_URL+="${CIRCLE_PROJECT_USERNAME}/"
pr_data_URL+="${CIRCLE_PROJECT_REPONAME}/"
pr_data_URL+="pulls/${CIRCLE_PR_NUMBER}"
pr_base=$(curl -s "${pr_data_URL}" | jq '.base.ref')
if [[ "${pr_base}" == "\"develop\"" ]]; then
echo_headline "You are PRing to the develop branch. This is good."
exit 0
elif [[ "${pr_base}" == "\"master\"" ]]; then
printf '=%.0s' {1..70}
printf "\n し(*・∀・) Thanks for the contribution! (・∀・*)\n"
printf '=%.0s' {1..70}
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}\""
exit 2
fi