Xteink-X4-crosspoint-reader/.github/workflows/pr-formatting-check.yml
Workflow config file is invalid. Please check your config file: yaml: line 40: did not find expected alphabetic or numeric character
Arthur Tazhitdinov e3c799e05c
Update .github/workflows/pr-formatting-check.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-01 16:51:19 +05:00

66 lines
2.1 KiB
YAML

name: "PR Formatting"
on:
pull_request_target:
types:
- opened
- reopened
- edited
permissions:
statuses: write
pull-requests: write
jobs:
title-check:
name: Title Check
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Check PR Title
id: title_check
uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment with changelog hint on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const marker = '<!-- pr-title-check -->';
const error =
`${{ steps.title_check.outputs.error_message || steps.title_check.outputs.error || '' }}`.trim();
const details = error ? `\n\n**Error:** ${error}` : '\n\n**Error:** See workflow logs.';
const body = `${marker}
**PR title check failed**
Please use a Conventional Commit-style prefix (e.g., \`feat:\`, \`fix:\`, \`docs:\`, \`chore:\`).
If this change should appear in release notes, ensure the title reflects the correct category.${details}`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find((comment) => comment.body && comment.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}