DanySK / gradle-pre-commit-git-hooks

A Gradle plugin enforcing pre-commit and commit-msg Git hooks configuration. Conventional-commits-ready.
Apache License 2.0
55 stars 5 forks source link

Execute Custom Script Before Applying Conventional Commits #517

Open theovier opened 7 months ago

theovier commented 7 months ago

What would you like to be able to do?

Hi,

I want to modify my commit message by a custom script (basically extracting a Jira ticket number from the branch name and prefixing the commit with it) and then still use your check for conventional commits afterwards.

I couldn't find a way to chain instructions for the commitMsg. I could only do either or. I could write all the logic for the convential commits inside my custom script too but this would defeat the purpose.

I tried

    commitMsg {
        conventionalCommits()
        appendScript { """            
            ./scripts/prepare-commit-msg.sh
            """ }
    }

but to no avail.

Kind regards, Theo

Is this a feature you are interested in implementing yourself?

No, I do not have the skills yet to do it

DanySK commented 7 months ago

Should be supported already. Can you produce a minimal reproduction kit?

theovier commented 7 months ago

Yes, however, it will probably take some time. Chances are good that you really do support it already and I just couldn't wrap my head around it.

Just to check: the idea of executing another script in the appendScript is the way you thought it could be done too, right?

DanySK commented 7 months ago

Yes