Skip to main content

cangulo.nuke.prcommitsvalidations

ยท 3 min read
Carlos Angulo Mascarell
Senior Platform Engineer
๐Ÿšง๐Ÿ›‘ Project discontinued

Problem I want to solveโ€‹

I want to make sure all the commits in a PR follow custom conventions based on the Conventional Commits specification. The conventions should be per repository. Let's consider fix, _minor _and major as a reference.

On the other hand, as I have been playing with NUKE lately, I want to create a solution based on it.

info

NUKE is a build automation framework where you define operations as build, test or push NuGets, in a C# project. I found good reviews and some videos in Channel9 about it. So, for instance, dotnet commands are predefined methods, and its arguments are extension methods, check the next example:

How a NUKE project looks like?
Target Pack => _ => _
.DependsOn(Clean)
.Executes(() =>
{
DotNetTasks
.DotNetPack(s => s
.SetProject(project.Path)
.SetOutputDirectory(outputFolderAbsolutePath)
.SetConfiguration(configuration)
.SetVersionPrefix(currentPackageVersion)
.SetVersionSuffix(versionSuffix)
.EnableNoRestore());
});

Goalsโ€‹

  • Validate the commits from a open PR.
  • The Solution should be based on NUKE.
  • Any repository should be able to use it.

Approachโ€‹

cangulo.nuke.prcommitsvalidations will execute the following operations sequentially:

  1. Get the commit list using the GH API Client provided by NUKE
  2. Validate they follow the conventions defined in the repo.

Remarksโ€‹

  • I'm not saying NUKE is the best solution, I just want to give it a try ๐Ÿ˜Š. In the future, I will create another solution based on scripts.
  • The conventions are defined in a json file, you can extend the next example:
{
"conventionalCommitTypes": [
"fix",
"minor",
"major"
]
}

How to use it?โ€‹

Please check the examples given here.

Where do I use it?โ€‹

I call this solution through a specific GH Action in the next projects:

Repositoryโ€‹

cangulo.nuke.prcommitsvalidations repository

GitHub Actionโ€‹

github action to execute in ANY repository

About meโ€‹

I'm a Senior Platform Engineer. I build and evolve Internal Developer Platforms โ€” golden paths, self-service tooling, and paved roads spanning AWS governance, CI/CD standardization, and developer enablement โ€” so engineering teams ship faster, safer, and more autonomously, with less cognitive load. My core stack is AWS, Terraform, and GitHub Actions, and I'm an AWS Certified Solutions Architect. I care deeply about paved roads, productivity, and documenting implementations so knowledge scales with the team (yes, I'm an engineer who likes to document ๐Ÿง‘โ€๐Ÿ’ป).

You can check my experience here.

Personal Blog - cangulo.github.io GitHub - Carlos Angulo Mascarell - cangulo
LinkedIn - Carlos Angulo Mascarell

Did you like it? Share It!


Comments