mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-16 19:48:09 +00:00
ci: improve changelog check
- ignore master branch - treat secfix/ same as release/ branches - allow skiping check with [no changelog] in commit message
This commit is contained in:
parent
23aa69caea
commit
07c53452f6
@ -4,13 +4,27 @@ base_branch=master
|
|||||||
fail=0
|
fail=0
|
||||||
subdirs="core python legacy/firmware legacy/bootloader"
|
subdirs="core python legacy/firmware legacy/bootloader"
|
||||||
|
|
||||||
|
changed_files=$(mktemp)
|
||||||
|
trap 'rm -- $changed_files' EXIT
|
||||||
|
|
||||||
git fetch origin "$base_branch"
|
git fetch origin "$base_branch"
|
||||||
|
|
||||||
check_feature_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
|
for subdir in $subdirs
|
||||||
do
|
do
|
||||||
echo "Checking $subdir"
|
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 . | grep -Fq -v .changelog.d; then
|
||||||
if ! echo "$files" | grep -Fq .changelog.d; then
|
if ! echo "$files" | grep -Fq .changelog.d; then
|
||||||
@ -29,7 +43,7 @@ check_release_branch () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if echo "$CI_COMMIT_BRANCH" | grep -q "^release/"; then
|
if echo "$CI_COMMIT_BRANCH" | grep -Eq "^(release|secfix)/"; then
|
||||||
check_release_branch
|
check_release_branch
|
||||||
else
|
else
|
||||||
check_feature_branch
|
check_feature_branch
|
||||||
|
@ -44,6 +44,8 @@ release commit messages prebuild:
|
|||||||
|
|
||||||
changelog prebuild:
|
changelog prebuild:
|
||||||
stage: prebuild
|
stage: prebuild
|
||||||
|
except:
|
||||||
|
- master
|
||||||
before_script: [] # nothing needed
|
before_script: [] # nothing needed
|
||||||
variables:
|
variables:
|
||||||
GIT_SUBMODULE_STRATEGY: "none"
|
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
|
You can also add this entry using your `$VISUAL` editor by running `towncrier
|
||||||
create --edit 1234.fixed` in the `core` directory.
|
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
|
## Generating changelog at the time of release
|
||||||
|
|
||||||
When it's time to release new version of a repository component the formatted
|
When it's time to release new version of a repository component the formatted
|
||||||
|
Loading…
Reference in New Issue
Block a user