melos icon indicating copy to clipboard operation
melos copied to clipboard

request: auto sign-off when commit use `melos version`

Open CaiJingLong opened this issue 2 years ago • 6 comments
trafficstars

Is there an existing feature request for this?

  • [X] I have searched the existing issues.

Command

No response

Description

Add sign-off and GPG sign for commits.

Reasoning

Signing a commit in git is a necessary thing to ensure that the commit was initiated by a validator.

Additional context and comments

In commits, the command I often use is git commit --signoff -S I wish there was an option added to melos version

CaiJingLong avatar Oct 20 '23 03:10 CaiJingLong

I'm not sure if Melos should directly support this itself, however we can enable you to do this perhaps by adding another hook to the version command (https://melos.invertase.dev/commands/version#hooks) that allows you to do your own command for committing already staged files (like preCommit allows you to stage your own extra things)

Wdyt? And are you willing to do a PR for it? 😄

Salakar avatar Nov 06 '23 15:11 Salakar

I can't understand the precommit part of the document and what step this preCommit does. I can only view it through the source code.


If I were to open PR to handle the problem, I should do one of the following two things:

  1. Custom args for git commit are allowed in version, and these parameters are inserted into the git commit command as they are.
  2. Add two flags to version subcommand, params name like git commit command, use -S(--gpg-sign=xxx), -s(--signoff).

Of course, they all also support configuring corresponding parameters in melos.yaml

CaiJingLong avatar Nov 09 '23 00:11 CaiJingLong

I would also like to see this supported.

provokateurin avatar Dec 26 '23 14:12 provokateurin

Isn't it enough if you just set git config commit.gpgsign true in the repository?

spydon avatar Jan 07 '24 19:01 spydon

Nope commit signing and the Signed-off-by tag are different things.

provokateurin avatar Jan 07 '24 19:01 provokateurin

Nope commit signing and the Signed-off-by tag are different things.

Ah right, of course. I guess the only way to do it outside of melos is something like this then:

git config --global alias.c 'commit -s'

spydon avatar Jan 07 '24 19:01 spydon