GitHub Action : conventional-commit-checker

Shailesh
4 min readJun 4, 2020

In this article, we will see how to write a GitHub Action and publish it to Github marketplace. GitHub Actions are GitHubs solution for CI/CD automation. This article was not my primary intention since I thought I could use something available on the GitHub market place, but as I was searching for different GitHub apps and actions on GitHub market place, I found some actions/apps that are similar I could not find the one the “exactly” fit my need.

So I want a GitHub action that checks for conventional commit format in Pull Requests.

Conventional commit in short has this below format

<type>[optional scope]: <description>

[optional body]

[optional footer]

My GitHub Actions goals are

  1. Check the Pull Request title for conformance of <type>[optional scope]: <description>
  2. Check the description of the Pull request for conformance of[optional body] and [optional footer]
  3. When PR is accepted, it should squash all the commits in the PR and the commit message should have the PR title, description, body and footer

Following the instructions from https://help.github.com/en/actions/creating-actions/creating-a-javascript-action , I got a hello world action working.

--

--

Shailesh

Solving Problems. Making Software Better. Intrigued by Elegant Solutions. https://twitter.com/agent_hunt