Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Add ${NC} and common message
Browse files Browse the repository at this point in the history
  • Loading branch information
kesselb committed Oct 20, 2018
1 parent 90ac4db commit 0727137
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .travis/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,54 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=_shared-vars.sh
. "${DIR}/_shared-vars.sh"

echo
echo "+++ Check if changelog was updated +++"
echo

if [[ ${TRAVIS_PULL_REQUEST} == false ]]; then
echo -e "${GREEN}+ Skip changelog check (no pull request)"
echo -e "${GREEN}+ Skip changelog check (no pull request)${NC}"
exit 0;
fi

if [[ ${TRAVIS_PULL_REQUEST_BRANCH} =~ ^dependabot/npm_and_yarn/(.+)$ ]]; then
echo -e "${GREEN}+ Skip changelog check (dependency update)"
echo -e "${GREEN}+ Skip changelog check (dependency update)${NC}"
exit 0;
fi

if [[ ${TRAVIS_BRANCH} == "develop" ]]; then
echo "+ Pull Request from ${TRAVIS_PULL_REQUEST_BRANCH} to ${TRAVIS_BRANCH}"
curl --silent https://raw.githubusercontent.com/geli-lms/geli/"${TRAVIS_BRANCH}"/CHANGELOG.md \
curl --silent "https://raw.githubusercontent.com/geli-lms/geli/${TRAVIS_BRANCH}/CHANGELOG.md" \
| diff CHANGELOG.md - \
| grep -P '^< - .{8,}' - -q
RESULT=$?;

if [[ ${RESULT} -eq 0 ]]; then
echo -e "${GREEN}+ Update in CHANGELOG.md found"
echo -e "${GREEN}+ Update in CHANGELOG.md found${NC}"
exit 0
else
echo -e "${RED}+ ERROR: No Update in CHANGELOG.md found!"
echo -e "${RED}+ ERROR: No Update in CHANGELOG.md found!${NC}"
echo "+ Please check if a line was added in the CHANGELOG.md."
exit 1
fi
fi

if [[ ${TRAVIS_BRANCH} == "master" ]]; then
echo "+ Pull Request from ${TRAVIS_PULL_REQUEST_BRANCH} to ${TRAVIS_BRANCH}"
curl --silent https://raw.githubusercontent.com/geli-lms/geli/"${TRAVIS_BRANCH}"/CHANGELOG.md \
curl --silent "https://raw.githubusercontent.com/geli-lms/geli/${TRAVIS_BRANCH}/CHANGELOG.md" \
| diff CHANGELOG.md - \
| grep -P '^< ## \[\[\d{1,3}\.\d{1,3}\.\d{1,3}\].*\] - \d{4}-\d{2}-\d{2} - .{10,}' - -q
RESULT=$?;

if [[ ${RESULT} -eq 0 ]]; then
echo -e "${GREEN}+ Update in CHANGELOG.md found"
echo -e "${GREEN}+ Update in CHANGELOG.md found${NC}"
exit 0
else
echo -e "${RED}+ ERROR: No Update in CHANGELOG.md found!"
echo -e "${RED}+ ERROR: No Update in CHANGELOG.md found!${NC}"
echo "+ Please check if a new version was added in the CHANGELOG.md."
echo "+ Or a new section for the next release was added."
exit 1
fi
fi

echo -e "${YELLOW}+ Pull Request but not against develop or master. No update for CHANGELOG.md required."
echo -e "${YELLOW}+ Pull Request but not against develop or master. No update for CHANGELOG.md required.${NC}"
exit 0

0 comments on commit 0727137

Please sign in to comment.