Skip to content

Collection of Git Hooks meant to be run with the GitHooks Maven plugin

License

Notifications You must be signed in to change notification settings

Willena/git-hooks-collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-hooks-collection

Collection of Git Hooks meant to be used with the GitHooks Maven plugin

Setup

Add the following dependency to your githook maven plugin definition

<dependencies>
    <dependency>
        <groupId>io.github.willena.maven.plugins</groupId>
        <artifactId>git-hooks-collection</artifactId>
        <version>${collection-version}</version>
    </dependency>
</dependencies>

Included Hooks

Echo

ClassName: io.github.willena.maven.plugins.githooks.Echo

Preferred git hook: any

Role: Logs any inputs of a given hook. Can be used to debug hooks

Usage:

<hookDefinition>
    <name>name</name>
    <runConfig>
        <className>io.github.willena.maven.plugins.githooks.Echo</className>
    </runConfig>
</hookDefinition>

CommitFollowConventional

ClassName: io.github.willena.maven.plugins.githooks.CommitFollowConventional

Preferred git hook: COMMIT_MSG

Role: Ensure a commit message follows the Conventional commit 1.0.0 specification

Usage:

<hookDefinition>
    <name>name</name>
    <runConfig>
        <className>io.github.willena.maven.plugins.githooks.CommitFollowConventional</className>
    </runConfig>
</hookDefinition>

CommitReferenceIssue

ClassName: io.github.willena.maven.plugins.githooks.CommitReferenceIssue

Preferred git hook: COMMIT_MSG

Role: Ensure a commit contains some issue reference

Usage:

<hookDefinition>
    <name>name</name>
    <runConfig>
        <className>io.github.willena.maven.plugins.githooks.CommitReferenceIssue</className>
    </runConfig>
</hookDefinition>

Full GitHook plugin example

<plugin>
    <groupId>io.github.willena.maven.plugins</groupId>
    <artifactId>githooks-maven-plugin</artifactId>
    <version>${plugin_version}</version>
    <dependencies>
        <dependency>
            <groupId>io.github.willena.maven.plugins</groupId>
            <artifactId>git-hooks-collection</artifactId>
            <version>${collection_version}</version>
        </dependency>
    </dependencies>
    <configuration>
        <gitConfig>
        </gitConfig>
        <debug>false</debug>
        <hooks>
            <hook>
                <type>COMMIT_MSG</type>
                <hookDefinitions>
                    <hookDefinition>
                        <enabled>false</enabled>
                        <name>echo</name>
                        <runConfig>
                            <className>io.github.willena.maven.plugins.githooks.Echo</className>
                        </runConfig>
                    </hookDefinition>
                    <hookDefinition>
                        <name>conventional-commit</name>
                        <runConfig>
                            <className>io.github.willena.maven.plugins.githooks.CommitFollowConventional</className>
                        </runConfig>
                    </hookDefinition>
                    <hookDefinition>
                        <name>reference-issue</name>
                        <runConfig>
                            <className>io.github.willena.maven.plugins.githooks.CommitReferenceIssue</className>
                        </runConfig>
                    </hookDefinition>
                </hookDefinitions>
            </hook>
        </hooks>
    </configuration>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>install</goal>
            </goals>
        </execution>
    </executions>
</plugin>

About

Collection of Git Hooks meant to be run with the GitHooks Maven plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages