Contents
Outline
In this blog post, I will introduce how to check if the Pull request
title follows Conventional Commits
using GitHub Actions
.
Blog series
This blog is made in series. Please check other blog posts through the following link.
- [GitHub Actions] Check Pull request title
- [GitHub Actions] Automate Release notes
- [GitHub Actions] Check Pull request labels
What is Conventional Commits
Conventional Commits
is a rule for standardizing commit messages used in software development. This is intended to make code changes more readable and easier to integrate with automated version control systems.
Conventional Commits
has the following structure.
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
- Type: A word that expresses the intent of the commit, typically feat (add feature), fix (fix bug), chore (change build or tool related), etc.
- Scope: An option that specifies which part of the change affects. Optional, so it can be omitted.
- Description: A part that contains a brief description of the changes, and must be written in the form of a command sentence.
Here, the type can be one of the followings.
- feat: Used when adding a new feature.
- fix: Used when fixing a bug.
- chore: Used when changing the build process or tool related.
- docs: Used when changing the document.
- style: Used when changing the code style or format.
- refactor: Used when refactoring the code. Used when improving the code structure without changing the functionality.
- test: Used when adding or modifying test related code.
- build: Used when changing the build system or external dependencies.
- ci: Used when changing CI/CD pipeline.
When creating a Pull request
in GitHub
, the first commit message of the branch is used by default. Therefore, if you follow Conventional Commits
when committing, you can use more meaningful titles when creating Pull request
.
Conventional PR Title Action
In this blog post, I will use Conventional PR Title Action
to check if the Pull request
title follows Conventional Commits
.
Create GitHub Actions
In order to use Conventional PR Title Action
in GitHub Actions
, create a .github/workflows/pr-title-checker.yml
file and modify it as follows.
name: Check PR title
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
jobs:
lint:
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
env:
GITHUB_TOKEN: $
This GitHub Actions
will check if the Pull request
title follows Conventional Commits
when a Pull request
is created or modified.
Completed
Done! We’ve seen how to check if the Pull request
title follows Conventional Commits
using GitHub Actions
.
In my case, the reason why this Pull request
title is checked to follow Conventional Commits
is to automate the creation of Release notes
using this Pull request
title.
For how to automate Release notes
using GitHub Actions
, please refer to the following link.
Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!
App promotion
Deku
.Deku
created the applications with Flutter.If you have interested, please try to download them for free.