A GitHub action that gets that commit messages. The action is able to act on pull request and push events and check the pull request title and body or the commit message of the commits of a push.
On pull requests the title and body are concatenated delimited by two line breaks.
See also action definition and the following example workflow.
excludeDescription
, excludeTitle
and checkAllCommitMessages
are optional.
Default behavior is to include the description and title and not check pull
request commit messages.
name: 'Commit Message Check'
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
push:
branches:
- main
- 'releases/*'
jobs:
check-commit-message:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- name: Get commit message
uses: dotCMS/commit-message-getter@v1
with:
excludeDescription: 'true' # optional: this excludes the description body of a pull request
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
git clone https://github.com/dotCMS/commit-message-getter.git
npm install
npm run build
That's it, just start editing the sources...
Below is a list of commands you will probably find useful during the development cycle.
Builds the package to the lib
folder.
Runs Prettier on .ts and .tsx files and fixes errors.
Runs Prettier on .ts and .tsx files without fixing errors.
Runs Eslint on .ts and .tsx files.
Bundles the package to the dist
folder.
Runs Jest test suites.
Runs all of the above commands.
More information about debugging Github Actions can be found at https://github.com/actions/toolkit/blob/main/docs/action-debugging.md.
The secrets ACTIONS_STEP_DEBUG
and ACTIONS_RUNNER_DEBUG
are both set to
true
in the main repository.
This project is released under the terms of the MIT License