Skip to content

chore: bump golangci/golangci-lint-action from 5.0.0 to 5.1.0 #952

chore: bump golangci/golangci-lint-action from 5.0.0 to 5.1.0

chore: bump golangci/golangci-lint-action from 5.0.0 to 5.1.0 #952

name: "Conventional commit titles"
on:
pull_request:
types:
# Check title when opened.
- opened
# Check title when new commits are pushed.
# Required to use as a status check.
- synchronize
# When the title or description change
- edited
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
env:
# Ensure pull request titles match the Conventional Commits specification
# https://www.conventionalcommits.org/en/v1.0.0/
regex: '^(feat|fix|chore|ci|refactor|test|docs)(\(.*\))?!?:'
with:
script: |
if (context.eventName != "pull_request") {
core.setFailed("This action only works on pull_request events");
return;
}
core.info(`Checking pull request title with regex: ${process.env.regex}`);
const regex = RegExp(process.env.regex);
const {data: pullRequest} = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});
const title = pullRequest.title;
core.info(`Pull Request title: "${title}"`);
if (!regex.test(title)) {
core.setFailed(`Pull Request title "${title}" failed to pass match regex - ${regex}`);
return;
}