ci: improve changelog check

- ignore master branch
- treat secfix/ same as release/ branches
- allow skiping check with [no changelog] in commit message
pull/1655/head
Martin Milata 3 years ago
parent 23aa69caea
commit 07c53452f6

@ -4,13 +4,27 @@ base_branch=master
fail=0
subdirs="core python legacy/firmware legacy/bootloader"
changed_files=$(mktemp)
trap 'rm -- $changed_files' EXIT
git fetch origin "$base_branch"
check_feature_branch () {
for commit in $(git rev-list origin/$base_branch..)
do
if git log -n1 --format=%B "$commit" | grep -iFq "[no changelog]"; then
echo "Found [no changelog] in $commit, skipping."
continue
fi
git show --pretty=format: --name-only "$commit" >> "$changed_files"
done
for subdir in $subdirs
do
echo "Checking $subdir"
files=$(git diff --name-only "origin/$base_branch..." -- "$subdir")
files=$(grep "^$subdir/" "$changed_files")
if echo "$files" | grep . | grep -Fq -v .changelog.d; then
if ! echo "$files" | grep -Fq .changelog.d; then
@ -29,7 +43,7 @@ check_release_branch () {
fi
}
if echo "$CI_COMMIT_BRANCH" | grep -q "^release/"; then
if echo "$CI_COMMIT_BRANCH" | grep -Eq "^(release|secfix)/"; then
check_release_branch
else
check_feature_branch

@ -44,6 +44,8 @@ release commit messages prebuild:
changelog prebuild:
stage: prebuild
except:
- master
before_script: [] # nothing needed
variables:
GIT_SUBMODULE_STRATEGY: "none"

@ -41,6 +41,13 @@ type you can add numeral suffix, e.g. `1234.fixed.1`, `1234.fixed.2`, etc.
You can also add this entry using your `$VISUAL` editor by running `towncrier
create --edit 1234.fixed` in the `core` directory.
## Not adding changelog entry
If you don't add an entry for changes in your branch, the `changelog prebuild`
CI job will remind you by failing. Sometimes adding an entry does not really make
sense, in that case you can include `[no changelog]` anywhere in the commit
message to exclude that commit from the check.
## Generating changelog at the time of release
When it's time to release new version of a repository component the formatted

Loading…
Cancel
Save