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

Exclude dependabot from changelog.md check #854

Merged
merged 9 commits into from
Oct 29, 2018
59 changes: 37 additions & 22 deletions .travis/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,58 @@

# Path to this file
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Path the script was called from
IPWD="$(pwd)"
kesselb marked this conversation as resolved.
Show resolved Hide resolved
# Import shared vars
. ${DIR}/_shared-vars.sh

# shellcheck source=_shared-vars.sh
kesselb marked this conversation as resolved.
Show resolved Hide resolved
. "${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)${NC}"
exit 0;
fi

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

if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "develop" ]; then
echo "+ detected pull request from ($TRAVIS_PULL_REQUEST_BRANCH) to $TRAVIS_BRANCH"
curl --silent https://raw.githubusercontent.com/geli-lms/geli/$TRAVIS_BRANCH/CHANGELOG.md \
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" \
| diff CHANGELOG.md - \
| grep -P '^< - .{8,}' - -q
RESULT=$?;

if [[ $? == 0 ]]; then
echo -e "${GREEN}+ Update in CHANGELOG.md found, exit${NC}"
if [[ ${RESULT} -eq 0 ]]; then
echo -e "${GREEN}+ Update in CHANGELOG.md found${NC}"
exit 0
else
echo -e "${RED}+ ERROR: No Update in CHANGELOG.md found!"
echo -e "+ Please check if a line was added in the CHANGELOG.md.${NC}"
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
elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
echo "+ detected pull request from ($TRAVIS_PULL_REQUEST_BRANCH) to $TRAVIS_BRANCH"
curl --silent https://raw.githubusercontent.com/geli-lms/geli/$TRAVIS_BRANCH/CHANGELOG.md \
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" \
| diff CHANGELOG.md - \
| grep -P '^< ## \[\[\d{1,3}\.\d{1,3}\.\d{1,3}\].*\] - \d{4}-\d{2}-\d{2} - .{10,}' - -q
RESULT=$?;

if [[ $? == 0 ]]; then
echo -e "${GREEN}+ Update in CHANGELOG.md found, exit${NC}"
if [[ ${RESULT} -eq 0 ]]; then
kesselb marked this conversation as resolved.
Show resolved Hide resolved
echo -e "${GREEN}+ Update in CHANGELOG.md found${NC}"
exit 0
else
echo -e "${RED}+ ERROR: No Update in CHANGELOG.md found!"
echo -e "+ Please check if a new version was added in the CHANGELOG.md."
echo -e "+ Or a new section for the next release was added${NC}"
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
else
echo -e "${YELLOW}+ WARNING: No Pull Request agiainst Develop or Master -> skipping automate changelog checking${NC}";
fi

echo -e "${YELLOW}+ Pull Request but not against develop or master. No update for CHANGELOG.md required.${NC}"
exit 0
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Update `README.md` with latest information. [#845](https://github.com/geli-lms/geli/pull/845)
- Exit build when no change to `CHANGELOG.md`. [#880](https://github.com/geli-lms/geli/pull/880)
- Use deploy token to push geli-docs. [#851](https://github.com/geli-lms/geli/issues/851), [#900](https://github.com/geli-lms/geli/pull/900), [#902](https://github.com/geli-lms/geli/pull/902)
- Exclude pull requests from dependabot from changelog check. [#854](https://github.com/geli-lms/geli/pull/854)

### Removed
- `isCourseTeacherOrAdmin` and `isMemberOfCourse` from `UserService`. [#731](https://github.com/geli-lms/geli/issues/731)
Expand Down