When using JIRA make sure to set
actions/checkout@v2 to pull from the pull_request HEAD. Github uses a single merge commit by default which is not referenced in git. This will cause commitsar JIRA check to fail as this commit will not be found by the API getting queried for PR by commit.
actions/checkout@v2 please set
fetch_depth to 0. Currently commitsar needs full git objects to work correctly. This will be fixed in an upcoming release.
Using the Github Action
A minimal example:
This will run
commitsar on every pull request and validate the commits for it.
Using Github Actions + Docker
This is a faster method since you don't have to build the Docker image in your Github action. If you need maximum security provided by Github actions please the Github Action Flow.
Using with JIRA pipeline
This pipeline example uses the checkout at PR HEAD. https://github.com/actions/checkout#Checkout-pull-request-HEAD-commit-instead-of-merge-commit