Files
youtube-generator/.github/workflows/maintenance-triage.yml
T
poli0981andClaude Opus 5.5 b2eb8236b4 chore(repo): enter maintenance mode — policy, auto-triage, issue forms, badges
YTDescGen is feature-complete; from 1.6.0 on it is maintained, not
extended. Still accepted: scheduled dependency updates; fixes for high or
critical CVEs and serious runtime issues; major language / runtime /
framework upgrades; bug, UI/UX and accessibility fixes, and options added
to or removed from the app's lists when people really need them;
translation fixes; Cloudflare / Worker changes the platform forces and
website incidents.

- README: status, CI, Qodana and SonarCloud badges; a Project status
  section; Contributing and the Roadmap row follow it.
- CONTRIBUTING: a Maintenance mode section, Option requests, issue and
  pull request rules, What We Want / Don't Want.
- SECURITY, MAINTAINERS, CLAUDE.md: the policy where each one needs it.
- ROADMAP: status block, a Maintenance mode section, Phase 5 and the
  backlog frozen. FEATURES: the extension points are frozen.
- Issue forms: Feature request removed; Option request and Translation or
  wording fix added; Bug report and Accessibility barrier now carry the
  `needs-triage` label (`triage` never existed). config.yml points feature
  ideas at Discussions → Ideas. The PR template gains a Scope checklist.
- maintenance-triage.yml closes, with a bilingual comment and the
  `out-of-scope` label, feature issues and `feat:` pull requests from
  outside contributors (scopes options, a11y and i18n stay open) and
  anything labelled `out-of-scope`. pull_request_target without checkout;
  listed under zizmor's dangerous-triggers ignore with the reason.

Labels created on the repository: out-of-scope, needs-triage, i18n,
option-request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:53:40 +07:00

108 lines
6.1 KiB
YAML

name: Maintenance triage
# YTDescGen is in maintenance mode (CONTRIBUTING.md → Maintenance mode). This
# workflow closes, with a bilingual comment and the `out-of-scope` label:
# • any issue or pull request the maintainer labels `out-of-scope`;
# • when opened by an outside contributor: issues titled [Feature…] or
# labelled `enhancement`, and pull requests titled `feat:` — except the
# scopes maintenance mode still takes: `options` (an agreed option
# request), `a11y` and `i18n`. The owner, members, collaborators and bots
# are skipped.
# pull_request_target runs in the base repository so it can comment on and
# close pull requests from forks. It never checks out or runs pull request
# code, and the script reads titles from the event payload itself instead of
# having untrusted text interpolated into it (.github/zizmor.yml says so too).
on:
issues:
types: [opened, labeled]
pull_request_target:
types: [opened, labeled]
permissions: {}
concurrency:
group: maintenance-triage-${{ github.event.issue.number || github.event.pull_request.number }}
cancel-in-progress: false
jobs:
triage:
name: Close out-of-scope requests
if: >-
(github.event.action == 'labeled' && github.event.label.name == 'out-of-scope') ||
(github.event.action == 'opened' &&
!contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'),
github.event.issue.author_association || github.event.pull_request.author_association))
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
issues: write
pull-requests: write
steps:
- name: Close if out of scope
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const OUT_OF_SCOPE = 'out-of-scope';
const TRUSTED = ['OWNER', 'MEMBER', 'COLLABORATOR'];
// Feature pull requests maintenance mode still takes.
const KEPT_SCOPES = ['options', 'a11y', 'i18n'];
const { payload } = context;
const isPR = Boolean(payload.pull_request);
const item = payload.pull_request ?? payload.issue;
if (!item || item.state !== 'open') return;
const labels = (item.labels ?? []).map((label) => label.name);
let reason = null;
if (payload.action === 'labeled') {
if (payload.label?.name === OUT_OF_SCOPE) reason = 'labelled out-of-scope';
} else if (payload.action === 'opened') {
const trusted = TRUSTED.includes(item.author_association);
const bot = item.user?.type === 'Bot';
const title = String(item.title ?? '').trim();
if (!trusted && !bot) {
if (isPR) {
// Conventional Commits: feat:, feat(scope):, feat!:
const feat = /^feat(?:\(([^)]*)\))?!?:/i.exec(title);
const scope = (feat?.[1] ?? '').trim().toLowerCase();
if (feat && !KEPT_SCOPES.includes(scope)) reason = 'feat: pull request';
} else if (/^\[feature/i.test(title) || labels.includes('enhancement')) {
reason = 'feature request';
}
}
}
if (!reason) {
core.info(`#${item.number}: within scope, nothing to do.`);
return;
}
const ideas = 'https://github.com/poli0981/youtube-generator/discussions/categories/ideas';
const policy = 'https://github.com/poli0981/youtube-generator/blob/main/CONTRIBUTING.md#maintenance-mode';
const en = isPR ? 'pull request' : 'issue';
const vi = isPR ? 'Pull request' : 'Issue';
const body = [
'<!-- maintenance-triage -->',
'Thanks for taking the time to write this. YTDescGen is in **maintenance mode**: it still takes dependency and security updates, major runtime upgrades, fixes for bugs, UI/UX, accessibility and translations, options added to or removed from its lists when people really need them, and Cloudflare or website fixes, but no new features.',
'',
`This ${en} falls outside that scope, so it has been closed. If it is actually a bug, an accessibility or translation fix, or an option request, reply here and the maintainer will take another look. Ideas are welcome in [Discussions → Ideas](${ideas}). The full policy is in [CONTRIBUTING.md → Maintenance mode](${policy}).`,
'',
'---',
'',
'Cảm ơn bạn đã dành thời gian. YTDescGen đang ở **giai đoạn bảo trì**: vẫn nhận cập nhật thư viện và bảo mật, nâng cấp runtime lớn, sửa lỗi, UI/UX, trợ năng (accessibility) và bản dịch, thêm hoặc bỏ một tuỳ chọn trong các danh sách của app khi thật sự có người cần, và sửa lỗi Cloudflare hay website, nhưng không thêm tính năng mới.',
'',
`${vi} này nằm ngoài phạm vi đó nên đã được đóng. Nếu thực ra đây là lỗi, sửa trợ năng hay bản dịch, hoặc yêu cầu tuỳ chọn, hãy trả lời tại đây để maintainer xem lại. Ý tưởng có thể gửi ở [Discussions → Ideas](${ideas}). Chính sách đầy đủ: [CONTRIBUTING.md → Maintenance mode](${policy}).`,
].join('\n');
const { owner, repo } = context.repo;
const number = item.number;
await github.rest.issues.createComment({ owner, repo, issue_number: number, body });
if (!labels.includes(OUT_OF_SCOPE)) {
await github.rest.issues.addLabels({ owner, repo, issue_number: number, labels: [OUT_OF_SCOPE] });
}
if (isPR) {
await github.rest.pulls.update({ owner, repo, pull_number: number, state: 'closed' });
} else {
await github.rest.issues.update({ owner, repo, issue_number: number, state: 'closed', state_reason: 'not_planned' });
}
core.notice(`Closed ${en} #${number} as out of scope (${reason}).`);