I still see many pull requests with a failing DCO Check and sometimes questions why this check fails or if its even necessary for the small change.
Instead of repeating my answers on github again and again i would like to write a short FAQ on dco check and the usage in the openhab-docs repository.
What is a sign-off-statement
Basically that is just a “comment” you make for every commit you are trying to contribute,
which has to be in a specified format with specified contents and it should be the last line of each commit you want to contribute.
Important: A sign-of-statement
is not related to securely signed or verified commits. No need to dig into signatures and keys. We just need the comment with your name and email!
You can find additional information about the sign-off in our contribution docs.
Especially why we need to have this statement from your side.
Two thing in advance
- The check is automated and runs for every pull request.
- It doesn’t know or look on the contents you are trying to contribute.
It just looks for your sign-off paragraph.
So what can i do to handle DCO check better.
There are two options:
- If you know you have a small changed introduced which doesn’t need a sign-off statement,
the reviewer (this is mostly myself at the time of writing this Post) will take care of it and override it if its reasonable. - You can always do a correct sign-off and the problem is solved immediately
I have chosen the second option some time ago.
For me it is the easiest way of dealing with sign-off.
I don’t have to think about whether a pull request is small enough for an exception or not.
It turned to an automatism and is done very fast.
Yeah fine, but how is this done correct?
On the commandline
This is really straight forward if you are already working with the git command line.
You just have to configure your credentials one time with:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
(Of course with your name and email.)
You can then sign off a commit with the -s
flag:
$ git commit -s -m "This is my commit message"
That’s it. Git will add the correct paragraph at the end of your commit message.
In the GitHub web editor
This is also not difficult, but unfortunately there is no native way to automate this.
(I think GitHub should have come up with a native solution long ago, but thats how it is currently…)
When you use the web editor, you have some form at the bottom of the edit page.
You can add your sign-off-statement
in the extended description.
Make sure that it is the last sentence of your commit.
DCO Check will recognise it and should pass.
(Maybe there can be other problems with your github account configuration, but mostly it should work now.)