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/apply_patch
2021-07-07 03:31:35 -07:00

38 lines
923 B
Bash
Executable file

#!/usr/bin/env bash
## apply_patch Apply patch to the target(official spacemacs) repository
##
## Copyright (c) 2014-2021 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
exit_if_no_changes
echo_headline "Cloning target repository"
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"
git clone "${target_URL}" -b "${PR_BRANCH}" "/tmp/${PUBLISH}"
if [ $? -ne 0 ]; then
echo "Failed to clone \"${target_URL}\""
exit 2
fi
cd "/tmp/${PUBLISH}"
echo_headline "Patching"
git apply --reject --whitespace=fix "/tmp/${PUBLISH}.patch"
if [ $? -ne 0 ]; then
echo "Failed to apply \"/tmp/${PUBLISH}.patch\"."
exit 2
fi
echo_headline "Creating commit"
git add --all
git commit -m "[bot] \"${PUBLISH}\" $(date -u)"
if [ $? -ne 0 ]; then
echo "Faild to create commit."
exit 2
fi