Skip to content

PR title validation. #1

PR title validation.

PR title validation. #1

Workflow file for this run

name: Conventional Commits Validator
on:
pull_request_target:
jobs:
validate:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Validate Conventional Commits format
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repo.name }}
run: |
title="${{ github.event.pull_request.title }}"
if [[ $title =~ ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert):(.*)$ ]]; then
echo "Pull request title is correctly formatted."
else
comment="Please ensure your pull request title follows the Conventional Commits standard. Example: 'type: brief description' where type is one of fix, feat, docs,
style, refactor, perf, test, build, ci, chore, or revert."

Check failure on line 24 in .github/workflows/lint_title.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/lint_title.yml

Invalid workflow file

You have an error in your yaml syntax on line 24
curl -s -X POST \
https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/issues/${PR_NUMBER}/comments \
-H 'Authorization: Bearer ${GITHUB_TOKEN}' \
-H 'Content-Type: application/json' \
-d '{"body":"'"${comment}"'"}'
echo "Comment added to pull request due to incorrect title format."
fi