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

Commit

Permalink
Check the changelog number in check-newsfragment (#7623)
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh authored Jun 3, 2020
1 parent 0188daf commit 86d814c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/7623.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update CI scripts to check the number in the newsfile fragment.
20 changes: 16 additions & 4 deletions scripts-dev/check-newsfragment
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ set -e

# make sure that origin/develop is up to date
git remote set-branches --add origin develop
git fetch origin develop
git fetch -q origin develop

pr="$BUILDKITE_PULL_REQUEST"

# if there are changes in the debian directory, check that the debian changelog
# has been updated
Expand All @@ -20,20 +22,30 @@ fi

# if there are changes *outside* the debian directory, check that the
# newsfragments have been updated.
if git diff --name-only FETCH_HEAD... | grep -qv '^debian/'; then
tox -e check-newsfragment
if ! git diff --name-only FETCH_HEAD... | grep -qv '^debian/'; then
exit 0
fi

tox -qe check-newsfragment

echo
echo "--------------------------"
echo

# check that any new newsfiles on this branch end with a full stop.
matched=0
for f in `git diff --name-only FETCH_HEAD... -- changelog.d`; do
# check that any modified newsfiles on this branch end with a full stop.
lastchar=`tr -d '\n' < $f | tail -c 1`
if [ $lastchar != '.' -a $lastchar != '!' ]; then
echo -e "\e[31mERROR: newsfragment $f does not end with a '.' or '!'\e[39m" >&2
exit 1
fi

# see if this newsfile corresponds to the right PR
[[ -n "$pr" && "$f" == changelog.d/"$pr".* ]] && matched=1
done

if [[ -n "$pr" && "$matched" -eq 0 ]]; then
echo -e "\e[31mERROR: Did not find a news fragment with the right number: expected changelog.d/$pr.*.\e[39m" >&2
exit 1
fi

0 comments on commit 86d814c

Please sign in to comment.