Use git diff to search for changelog entry
This commit is contained in:
parent
3867b52aef
commit
50e237759a
|
@ -49,6 +49,7 @@ check-changelog:
|
||||||
after_script: ''
|
after_script: ''
|
||||||
cache: {}
|
cache: {}
|
||||||
script:
|
script:
|
||||||
|
- apk add git
|
||||||
- sh ./tools/check-changelog
|
- sh ./tools/check-changelog
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "looking for change log of $CI_MERGE_REQUEST_IID"
|
echo "looking for change log"
|
||||||
|
|
||||||
count=0
|
git diff --raw $CI_MERGE_REQUEST_TARGET_BRANCH_NAME HEAD -- changelog.d | \
|
||||||
for i in add remove fix security skip; do
|
grep ' A\t' | grep '\.\(skip\|add\|remove\|fix\|security\)$'
|
||||||
[ -f changelog.d/"$CI_MERGE_REQUEST_IID"."$i" ]
|
ret=$?
|
||||||
retcode=$?
|
|
||||||
if [ $retcode -eq 0 ]; then
|
if [ $ret -eq 0 ]; then
|
||||||
echo "found $CI_MERGE_REQUEST_IID.$i"
|
echo "found a changelog entry"
|
||||||
count=$(( count + 1 ))
|
|
||||||
else
|
|
||||||
echo "no $CI_MERGE_REQUEST_IID.$i"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ $count -gt 0 ]; then
|
|
||||||
echo "ok"
|
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "must have a changelog entry or explicitly skip it"
|
echo "changelog entry not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue