Skip to content

test: add PDP/PLP add to cart dialog e2e test #174

test: add PDP/PLP add to cart dialog e2e test

test: add PDP/PLP add to cart dialog e2e test #174

name: PR Title Check
on:
pull_request:
types: [opened, edited, synchronize, reopened]
jobs:
check-pr-title:
name: PR - Check PR title
runs-on: ubuntu-latest
steps:
- name: Validate PR title
id: validate
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo "Checking PR title: ${PR_TITLE}"
REGEX='^(docs|feat|fix|perf|refactor|style|test|chore)(\([^)]*\))?:\ .+'
if [[ ! "$PR_TITLE" =~ $REGEX ]]; then
echo "❌ PR title is invalid. Example of a valid title: \`feat: Add user authentication\`, \`chore(deps): update dependency babel-loader to v10\`. Allowed prefixes: docs, feat, fix, perf, refactor, style, test, chore"
exit 1
fi
comment-on-failure:
needs: check-pr-title
if: failure()
runs-on: ubuntu-latest
steps:
- name: Post PR comment on failure
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const commentBody = `# 🚨 PR Title Validation Failed 🚨
Your pull request title does not follow the required format. Please update it to match the expected pattern:
**Expected format:**
\`<type>: <subject>\`
## **Allowed Types**
- **docs:** Changes to documentation only
- **feat:** New feature work
- **fix:** Bug fixes
- **perf:** Code improvements for performance
- **refactor:** Code changes that are not bug fixes or features
- **style:** Code style changes (e.g., whitespace, formatting)
- **test:** Adding or updating tests
- **chore:** Build, CI, scripts, configs, etc.
## **Example of a valid PR title**
✅ \`feat: Add user authentication\`
✅ \`fix: Resolve checkout bug\`
✅ \`docs: Update API documentation\`
❌ **Merge is blocked until the PR title is corrected.**`;
github.rest.issues.createComment({
issue_number: issue_number,
owner: owner,
repo: repo,
body: commentBody
});