Skip to content

feat: add config option to enable Signed-off-by in commit messages#7766

Open
emersion wants to merge 2 commits intodecaporg:mainfrom
emersion:signed-off-by
Open

feat: add config option to enable Signed-off-by in commit messages#7766
emersion wants to merge 2 commits intodecaporg:mainfrom
emersion:signed-off-by

Conversation

@emersion
Copy link
Copy Markdown

@emersion emersion commented Mar 27, 2026

Summary

Some organizations require Signed-off-by trailers in commit
messages (e.g. for Developer Certificate of Origin). GitHub has a
setting to enable this when authoring changes from the Web UI.
This patch adds a similar setting for DecapCMS.

Note, most backends don't need any change for the new email field because they already populate it.

Closes: #7730

Test plan

  1. Add signoff_commits: true to the backend config.
  2. Author a change in DecapCMS.
  3. Commit message should have a Signed-off-by trailer.

Note, a logout + login might be required with GitHub to refresh cached auth data. The backend needs to populate the email field (GitHub, GitLab, Gitea, etc should work fine).

Checklist

A picture of a cute animal (not mandatory but encouraged)
image

@emersion emersion requested a review from a team as a code owner March 27, 2026 13:49
Copy link
Copy Markdown
Contributor

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @emersion, good work. I have a few questions/sugestion for you.

First, could you update the Gitea and Git Gateway backends to pass email down? That should ensure they also can use this feature.

Also, it would be nice to add another test ensuring no trailer is added when the option is disabled.

const templates = { ...commitMessageTemplates, ...(config.backend.commit_messages || {}) };

let trailers = '';
if (config.backend.signoff_commits && authorName && authorEmail) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering, maybe there should be a log if the option is enabled but there's no authorEmail so organizations that need it can track this issue down?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Added some logging.

emersion added 2 commits April 7, 2026 10:28
Most backends don't need any change because they already populate
this field.
Some organizations require Signed-off-by trailers in commit
messages (e.g. for Developer Certificate of Origin). GitHub has a
setting to enable this when authoring changes from the Web UI.
This patch adds a similar setting for DecapCMS.

Closes: decaporg#7730
@emersion
Copy link
Copy Markdown
Author

emersion commented Apr 7, 2026

First, could you update the Gitea and Git Gateway backends to pass email down? That should ensure they also can use this feature.

Yes! Done.

Also, it would be nice to add another test ensuring no trailer is added when the option is disabled.

I think existing tests already cover this case? For instance should return default commit message on create, label_singular is the exact same test but with the option disabled.

Copy link
Copy Markdown
Contributor

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@emersion
Copy link
Copy Markdown
Author

emersion commented Apr 8, 2026

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Signed-off-by trailers to commit messages

2 participants