From c64a616d54dc62030e7637582d3a58d14f13f118 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Wed, 31 May 2023 11:30:51 +0100 Subject: [PATCH] Update the changelog entry checker script to check newsfragment file extension (#1542) --- changelogs/internal/newsfragments/1542.clarification | 1 + scripts/check-newsfragments | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 changelogs/internal/newsfragments/1542.clarification diff --git a/changelogs/internal/newsfragments/1542.clarification b/changelogs/internal/newsfragments/1542.clarification new file mode 100644 index 00000000..422a4eef --- /dev/null +++ b/changelogs/internal/newsfragments/1542.clarification @@ -0,0 +1 @@ +Update the CI to validate the file extension of changelog entries. \ No newline at end of file diff --git a/scripts/check-newsfragments b/scripts/check-newsfragments index ddba0d28..242b46d8 100755 --- a/scripts/check-newsfragments +++ b/scripts/check-newsfragments @@ -21,6 +21,12 @@ matched=0 while read f; do basename=$(basename $f) dirname=$(dirname $f) + extension="${f##*.}" + + # check that each changelog file has a known extension + if ! [[ "$extension" == "new" || "$extension" == "feature" || "$extension" == "clarification" || "$extension" == "breaking" || "$extension" == "deprecation" ]]; then + echo -e "\e[31mERROR: newsfragment $f does not have one of the required file extensions for a changelog entry: .new, .feature, .clarification, .breaking, .deprecation\e[39m" >&2 + fi # check that there is nothing that looks like a newsfile outside one of the # expected directories. @@ -31,6 +37,7 @@ while read f; do # see if this newsfile corresponds to the right PR [[ -n "$pr" && "$basename" == "$pr".* ]] && matched=1 fi +# find all files in the 'changelogs/*/' dirs that are in the form `.` done < <(find changelogs -regex '.*/[0-9]+\.[^/]+$') if [[ -n "$pr" && "$matched" -eq 0 ]]; then