mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-21 05:59:35 +08:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0...3d3c42e5aac5ba805825da76410c181273ba90b1) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
60 lines
2.4 KiB
YAML
60 lines
2.4 KiB
YAML
name: Issue area labeler
|
|
|
|
# Adds area labels to new/edited issues based on keyword regexes in
|
|
# .github/issue-labeler.yml. Additive only (addLabels never removes): it
|
|
# never touches a label a maintainer set by hand. Base bug/enhancement
|
|
# labels already come from the issue forms.
|
|
#
|
|
# Implemented with first-party actions/github-script (not a third-party
|
|
# labeler action) so every pattern is compiled as a JavaScript RegExp with
|
|
# the `i` flag applied centrally — inline `(?i)` groups are PCRE-only and
|
|
# threw `SyntaxError: Invalid group` on every issue (#764). A pattern that
|
|
# fails to compile now fails the run loudly instead of silently no-oping.
|
|
|
|
on:
|
|
issues:
|
|
types: [opened, edited]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
triage:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const text = [context.payload.issue.title, context.payload.issue.body]
|
|
.filter(Boolean).join('\n');
|
|
const rules = [];
|
|
const bad = [];
|
|
// Config format: one rule per line — "label": 'regex' (see the
|
|
// header comment in .github/issue-labeler.yml).
|
|
for (const line of fs.readFileSync('.github/issue-labeler.yml', 'utf8').split('\n')) {
|
|
const m = line.match(/^"([^"]+)":\s*'(.*)'\s*$/);
|
|
if (!m) continue;
|
|
try { rules.push({ label: m[1], re: new RegExp(m[2], 'i') }); }
|
|
catch (e) { bad.push(`${m[1]}: ${e.message}`); }
|
|
}
|
|
if (rules.length === 0 && bad.length === 0) {
|
|
core.setFailed('no labeling rules parsed from .github/issue-labeler.yml');
|
|
return;
|
|
}
|
|
const labels = rules.filter(r => r.re.test(text)).map(r => r.label);
|
|
if (labels.length) {
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
labels,
|
|
});
|
|
}
|
|
core.info(`matched: ${labels.join(', ') || '(none)'}`);
|
|
if (bad.length) core.setFailed(`invalid label regex(es): ${bad.join('; ')}`);
|