Add githooks to manage commit DCO sign-off#1932
Conversation
|
Looks good thanks for this. To me but I'd probably stay away from "auto filling DCO" and leave that to user, but block the pipeline. Having CI adjust the commit + autofill seems risky to me. |
|
The way I set this up, it has 2 hooks:
The CI never adjusts the commit, unless I misunderstand something about how GH handles git hooks. If you think the prepare-commit-msg hook is still too risky, which would you like best:
|
|
Apologies I read it too quick, yes this is a local git hook. I'd drop this though still and go for 1. Just keep the ci check in place (and leave users to themselves). |
| args: | ||
| - -c | ||
| - | | ||
| if ! ( git interpret-trailers --parse "$1" | grep -q "Signed-off-by:" "$1" ); then |
There was a problem hiding this comment.
You want to remove the trailing $1 here. This will read it from stdin and exit 0 if it exists.
| language: system | ||
| always_run: true | ||
|
|
||
| - id: prepare-dco |
There was a problem hiding this comment.
I think I am with @bhcopeland, might be safer if we just use the pre commit check for DCO, and leave the user to add it by themselves.
I am not sure if we have permissions to add check on CI as well, but if we do, might be a good idea.
Signed-off-by: Luiz Georg <luiz.georg@profusion.mobi>
Signed-off-by: Luiz Georg <luiz.georg@profusion.mobi>
|
Removed the prepare-commit-msg hook and fixed code, ready for another review |
|
LGTM :) |
Adds a local commit-msg git-hook to check for commit messages without the DCO "Signed-off-by:" trailer.
Closes: #1922
Related: #1930, #1931
Caveats