Skip to content

Update pr-convention safdasdfsd #10

Update pr-convention safdasdfsd

Update pr-convention safdasdfsd #10

Workflow file for this run

name: PR Title Validation
on:
pull_request:
types: [opened, edited, synchronize, reopened]
jobs:
title-check:
runs-on: ubuntu-latest
outputs:
SUGGESTED_TITLE: ${{ steps.suggest-title.outputs.SUGGESTED_TITLE }}
steps:
- name: Check PR Title
id: check-title
uses: naveenk1223/action-pr-title@master
with:
regex: '^[a-zA-Z]+(\([a-zA-Z]+\))?: .+'
allowed_prefixes: "feat,fix,docs,style,refactor,test,chore,ci,perf,revert"
prefix_case_sensitive: false
min_length: 1
max_length: -1
- name: Set Suggested Title
id: suggest-title
if: failure()
run: |
# Extract the current PR title
current_title="${{ github.event.pull_request.title }}"
# Parse the current PR title
IFS=':' read -r -a parts <<< "$current_title"
type="${parts[0]}"
description="${parts[1]}"
# Generate a new title
suggested_title="$type(new_scope): $description"
# Set the new title as an output
echo "SUGGESTED_TITLE=$suggested_title" >> $GITHUB_ENV
suggest-title:
runs-on: ubuntu-latest
needs: title-check
steps:
- name: Comment on PR with suggested title
run: |
echo "Suggested PR title: $SUGGESTED_TITLE"
gh pr comment ${{ github.event.number }} --body "The PR title does not follow the required format. Consider using the following suggested title: $SUGGESTED_TITLE"