gitlab-ci: Make sure commits are signed-off before merge

Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>
merge-requests/46/head
Vasilis Tsiligiannis 2022-07-27 13:54:18 +03:00
parent bc2c925c7a
commit d734fccc39
1 changed files with 20 additions and 0 deletions

20
.gitlab-ci.yml 100644
View File

@ -0,0 +1,20 @@
variables:
GITLAB_CI_IMAGE_ALPINE: 'alpine:3.16.1'
GITLAB_CI_SIGN_OFF_EXCLUDE: '40de4742d5277525f4b0e387121bd3c2c0ad323f'
stages:
- static
# 'static' stage
sign_off:
stage: static
needs: []
image: ${GITLAB_CI_IMAGE_ALPINE}
before_script:
- apk add --no-cache git
script: >-
git log
--grep "^Signed-off-by: .\+<.\+\(@\| at \).\+\(\.\| dot \).\+>$"
--invert-grep
--format="Detected commit '%h' with missing or bad sign-off! Please read 'CONTRIBUTING.md'."
--exit-code
"$(rev=$(git rev-parse -q --verify "$GITLAB_CI_SIGN_OFF_EXCLUDE^{commit}") && echo "$rev..")"