Skip to content

docs: update READMEs with performance metrics, architecture and badges #24

docs: update READMEs with performance metrics, architecture and badges

docs: update READMEs with performance metrics, architecture and badges #24

Workflow file for this run

name: 🤖 Auto-assign & Label
on:
pull_request:
types: [opened, reopened]
issues:
types: [opened]
jobs:
auto-assign:
name: 🤖 Triage
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: 👤 Auto-assign Creator
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
if (pr) {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: [pr.user.login]
});
console.log(`🤖 Auto-assigned PR #${context.issue.number} to author @${pr.user.login}`);
}
- name: 🏷️ Auto-label based on title
if: github.event_name == 'issues' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Safely extract title using optional chaining
const title = context.payload.pull_request?.title || context.payload.issue?.title;
const issueNumber = context.issue.number;
if (!title) {
console.log('ℹ️ No title found, skipping...');
return;
}
const labelsToAdd = new Set();
// Mappings for conventional commit types
const typeMappings = [
{ pattern: /^(feat|feature)(\(.*\))?:/i, label: 'type: feature' },
{ pattern: /^fix(\(.*\))?:/i, label: 'type: bug' },
{ pattern: /^docs(\(.*\))?:/i, label: 'type: docs' },
{ pattern: /^(chore|build|ci|test)(\(.*\))?:/i, label: 'type: maintenance' },
{ pattern: /^(refactor|perf)(\(.*\))?:/i, label: 'type: maintenance' }
];
for (const mapping of typeMappings) {
if (mapping.pattern.test(title)) {
labelsToAdd.add(mapping.label);
break;
}
}
// Extract scope from parentheses (e.g., feat(core): -> core)
const scopeMatch = title.match(/^[\w-]+(?:\(([\w-]+)\))?:/);
if (scopeMatch && scopeMatch[1]) {
const scope = scopeMatch[1].toLowerCase();
if (scope === 'core') labelsToAdd.add('area: core');
if (scope === 'zod') labelsToAdd.add('area: zod');
if (scope === 'infra' || scope === 'deps') labelsToAdd.add('area: infra');
}
// Apply labels if any were matched
if (labelsToAdd.size > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
labels: Array.from(labelsToAdd)
});
console.log(`🏷️ Added labels to #${issueNumber}: ${Array.from(labelsToAdd).join(', ')}`);
} else {
console.log(`ℹ️ No labels matched the title: "${title}"`);
}