statamic / spock

Automatically perform git commits, pushes, and other cli actions when Statamic content changes
95 stars 16 forks source link

Custom commit message #25

Open mikhailbot opened 5 years ago

mikhailbot commented 5 years ago

So I know you can create custom commands to do things, but is there an easy way to add some text before/after the commit message so that when looking at the commit history we know it's from Spock?

So instead of Submission saved it could be [Spock] Submission saved or some other easy way to see what's an automated change versus a human one?

mikhailbot commented 5 years ago

If a custom command is the way to do this, I assume I'd adjust the below to something like:

$commands[] = vsprintf('git commit -m "%s%s%s"', [
    '[Spock] ',
    $this->label(),
    $this->user ? ' by ' . $this->user->username() : ''
]);
jasonvarga commented 5 years ago

You could try changing the git user name or email to be Spock in commands_before

git config user.name "Spock"

mikhailbot commented 5 years ago

You could try changing the git user name or email to be Spock in commands_before

git config user.name "Spock"

Oh yeah, that could be better even, so it doesn't look like I'm the one committing everything!

mikhailbot commented 5 years ago

So the only downside to that is because the email is still mine, Github will show my username not Spock. I could change the email and that would work showing as an unknown user instead of myself. Not ideal but I think that'll work for now.

aerni commented 5 years ago

The new Spock Update is awesome. @jasonvarga Can you do something like this:

git_username: '{{ committer:username }}'
git_email: '{{ committer:email }}'