Skip to content

docs: add AI attribution policy #502

docs: add AI attribution policy

docs: add AI attribution policy #502

Workflow file for this run

name: "Label PR by conventional commit prefix"
on:
pull_request_target:
types: [opened, edited, synchronize]
merge_group:
jobs:
label:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
steps:
- name: Apply label based on PR title prefix
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v7
with:
script: |
const title = context.payload.pull_request.title;
const labelMap = {
'feat': 'enhancement',
'fix': 'bug',
'docs': 'documentation',
'test': 'testing',
'perf': 'enhancement',
'refactor': 'enhancement',
'ci': 'integrations',
'chore': null,
'build': null,
'style': null,
'revert': null,
'release': null,
};
const match = title.match(/^(\w+)[\(!\:]/);
if (!match) { core.setFailed(`PR title "${title}" does not match conventional commit format.`); return; }
const prefix = match[1];
const label = labelMap[prefix];
if (label === undefined) { core.setFailed(`PR title prefix "${prefix}" is not a recognized conventional commit type.`); return; }
if (!label) return;
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: [label],
});
- name: Skip label in merge queue
if: github.event_name == 'merge_group'
run: echo "PR title already validated at PR open/edit time"