ci: close feature requests in maintenance mode, and say why

triage.yml labels a feature request enhancement and out-of-scope,
answers in English and Vietnamese with CONTRIBUTING linked, and closes
it as not planned — on unmistakable signals only: a title that says it
is one, a feat: pull request, or the enhancement label going on.
Maintainers, bots and policy-exception are never closed. The rules live
in .github/scripts/triage.cjs with node --test cases (run by npm
licences); pull_request_target checks out only the base branch's
scripts; workflow_dispatch is a dry run. notify.yml hears about it.

Templates: a Wording or translation form (i18n), a contact link saying
features are not taken, a maintenance note on the bug form, and the
kinds of change a pull request can be. eslint.config.js lints the
CommonJS helper as Node, outside the type-aware program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5.5 committed 2026-11-21 23:22:12 +07:00
1 parent cfa5b4e1be
commit 61e5e26c4e
10 files changed
+444 -5

No files matched your search

+4
View File
@@ -9,6 +9,10 @@ body:
Thanks for the report! If you came here from the in-app **Report bug** button, most fields
are prefilled and the full log was copied to your clipboard — paste it below if asked.
Vui lòng viết bằng English hoặc Tiếng Việt đều được.
PipDock is in **maintenance mode**: bugs, UI/UX defects and accessibility barriers are
exactly what it is maintained for. A feature request filed here is closed automatically —
see CONTRIBUTING.md, "Scope in maintenance mode".
- type: input
id: pd-version
attributes:
+4 -1
View File
@@ -3,9 +3,12 @@
blank_issues_enabled: false
contact_links:
- name: Feature request — not accepted during maintenance
url: https://github.com/poli0981org/pipdock/blob/main/CONTRIBUTING.md#scope-in-maintenance-mode
about: Since 1.6.0 PipDock takes fixes, not features. An issue or pull request asking for one is closed automatically; this explains what is accepted, and where to argue that something is truly necessary.
- name: Question or idea
url: https://github.com/poli0981org/pipdock/discussions
about: Ask about usage, propose a feature, or share a workflow.
about: Ask about usage or share a workflow. Ideas are welcome to discuss, but during maintenance they are not on a roadmap.
- name: Security vulnerability
url: https://github.com/poli0981org/pipdock/security/advisories/new
about: Report privately via GitHub Security Advisories. Please do not open a public issue.
+52
View File
@@ -0,0 +1,52 @@
name: Wording or translation problem
description: Text in PipDock that is wrong, misleading, misspelt, or reads badly in English or Vietnamese — Câu chữ hoặc bản dịch sai, gây hiểu nhầm, sai chính tả hay không tự nhiên
title: "[Wording]: "
labels: ["i18n", "triage"]
body:
- type: markdown
attributes:
value: |
PipDock is in maintenance mode, and fixing words is part of it: a sentence that misleads, a
spelling mistake that changes the meaning, or a translation that does not sound like
Vietnamese as people speak it is a bug worth a report. Quote the text exactly as it
appears — that is how it is found in the catalogues.
PipDock đang ở giai đoạn bảo trì, và sửa câu chữ là một phần việc đó: một câu dễ gây hiểu
nhầm, lỗi chính tả làm sai nghĩa, hay bản dịch không giống cách người Việt vẫn nói đều đáng
được báo. Hãy chép nguyên văn đoạn chữ như nó hiện trên màn hình.
- type: dropdown
id: language
attributes:
label: Which language? / Ngôn ngữ nào?
options:
- "English"
- "Tiếng Việt"
- "Both / Cả hai"
validations:
required: true
- type: textarea
id: current
attributes:
label: The text as it is now / Đoạn chữ hiện tại
description: Exactly as it appears, and where — the screen, the dialog, or the CLI command.
placeholder: "Environments → the button beside Rescan: \"…\""
validations:
required: true
- type: textarea
id: problem
attributes:
label: What is wrong with it / Vấn đề là gì
description: Misleading, wrong, misspelt, unnatural — and, if it misleads, what you understood from it.
validations:
required: true
- type: textarea
id: suggestion
attributes:
label: A better wording, if you have one / Cách viết tốt hơn, nếu có
- type: input
id: pd-version
attributes:
label: PipDock version
placeholder: "x.y.z — shown under About → This build"
validations:
required: true
+13
View File
@@ -1,8 +1,21 @@
<!--
One pull request is one slice: a single thing, taken deep, with its tests. CONTRIBUTING.md has the
details. Delete the sections that do not apply.
PipDock is in maintenance mode (CONTRIBUTING.md, "Scope in maintenance mode"): a pull request that
adds a feature is closed automatically, and so is one titled `feat:`.
-->
## What kind of change
- [ ] A bug fix
- [ ] A UI/UX defect
- [ ] An accessibility barrier
- [ ] Wording or a translation (English or Vietnamese)
- [ ] A dependency, runtime or toolchain update
- [ ] A security fix
- [ ] Documentation
## What this changes
<!-- What a user or a script would notice, and why. Link the issue or the docs/ROADMAP.md entry. -->
+154
View File
@@ -0,0 +1,154 @@
/**
* Maintenance-mode triage — run by .github/workflows/triage.yml through actions/github-script.
*
* Since 1.6.0 PipDock takes bug fixes, UI/UX and accessibility problems, wording and translation
* fixes, and dependency and security updates, and no new features (CONTRIBUTING.md, "Scope in
* maintenance mode"). A feature request is labelled `enhancement` and `out-of-scope`, answered in
* English and Vietnamese, and closed as not planned.
*
* **Only on signals that cannot be a bug report**, because closing a real report would be worse
* than leaving a request open: a title that says it is a feature (`[Feature]`, `Feature request:`,
* `[Tính năng]` …), a pull request titled with the Conventional Commits `feat` type the repository
* uses, or the `enhancement` label being put on. Words in a body decide nothing.
*
* **Never** for the owner, members and collaborators, for bots (Dependabot), or for anything
* labelled `policy-exception` — the maintainer's way of keeping open a feature judged truly
* necessary, which the policy allows.
*
* `classify` is pure and tested with `node --test` (triage.test.cjs); `run` is the thin part that
* talks to GitHub.
*/
'use strict'
const MAINTAINERS = new Set(['OWNER', 'MEMBER', 'COLLABORATOR'])
const EXEMPT = 'policy-exception'
const FEATURE_LABEL = 'enhancement'
const OUT_OF_SCOPE = 'out-of-scope'
const POLICY_URL =
'https://github.com/poli0981org/pipdock/blob/main/CONTRIBUTING.md#scope-in-maintenance-mode'
const IDEAS_URL = 'https://github.com/poli0981org/pipdock/discussions/categories/ideas'
/** `[Feature] …`, `[Feature request]: …`, `Feature request: …`, `[Tính năng] …`, `Đề xuất tính năng: …`. */
const FEATURE_TITLE =
/^\s*(?:\[\s*(?:feature(?:\s+request)?|enhancement|request|tính năng|đề xuất(?:\s+tính năng)?)\s*\]|(?:feature\s+request|feature|enhancement|đề xuất tính năng|tính năng mới)\s*:)/iu
/** `feat: …`, `feat(ui): …`, `feat!: …` — the Conventional Commits type this repository uses. */
const FEAT_COMMIT = /^\s*feat(?:\([^)]*\))?!?:/i
/**
* Whether an issue or pull request is a feature request this policy closes.
*
* @param {object} item
* @param {'issue'|'pull_request'} item.kind
* @param {string} item.title
* @param {string[]} item.labels Names of the labels it carries now.
* @param {string} item.association The author's `author_association`.
* @param {boolean} item.authorIsBot
* @param {string} item.state `open` or `closed`.
* @param {string|null} item.addedLabel The label a `labeled` event put on, else null.
* @returns {{close: boolean, reason: string}}
*/
function classify(item) {
if (item.state !== 'open') return { close: false, reason: 'not open' }
if (item.authorIsBot) return { close: false, reason: 'opened by a bot' }
if (MAINTAINERS.has(item.association)) return { close: false, reason: 'opened by a maintainer' }
if (item.labels.includes(EXEMPT)) return { close: false, reason: `labelled ${EXEMPT}` }
if (item.labels.includes(OUT_OF_SCOPE)) return { close: false, reason: 'already handled' }
if (item.addedLabel === FEATURE_LABEL) return { close: true, reason: `labelled ${FEATURE_LABEL}` }
if (item.addedLabel !== null) return { close: false, reason: `labelled ${item.addedLabel}` }
if (item.kind === 'pull_request' && FEAT_COMMIT.test(item.title)) {
return { close: true, reason: 'a feat: pull request' }
}
if (FEATURE_TITLE.test(item.title)) return { close: true, reason: 'titled as a feature request' }
return { close: false, reason: 'not a feature request' }
}
/** The answer left on a closed request, in both of the project's languages. */
function comment(kind) {
const what = kind === 'pull_request' ? 'pull request' : 'issue'
const cái = kind === 'pull_request' ? 'Pull request' : 'Issue'
return [
'Thanks for taking the time to write this.',
'',
`PipDock has been in **maintenance mode** since 1.6.0: it takes bug fixes, UI/UX and accessibility problems, wording and translation fixes, and dependency and security updates — and no new features. This ${what} reads as a feature request, so it has been labelled \`${OUT_OF_SCOPE}\` and closed. [CONTRIBUTING.md](${POLICY_URL}) says what is accepted and why.`,
'',
`If it is really a bug or a barrier, say so in a comment and it will be looked at again. If you believe the feature is truly necessary, make the case in [Discussions → Ideas](${IDEAS_URL}).`,
'',
'---',
'',
`Cảm ơn bạn đã dành thời gian viết. Từ bản 1.6.0, PipDock ở **giai đoạn bảo trì**: chỉ nhận sửa lỗi, lỗi UI/UX và khả năng tiếp cận, sửa câu chữ và bản dịch, cập nhật phụ thuộc và bảo mật — không nhận tính năng mới. ${cái} này là một đề xuất tính năng, nên đã được gắn nhãn \`${OUT_OF_SCOPE}\` và đóng lại. Nếu đây thật ra là lỗi, hãy bình luận để được xem lại; nếu bạn tin tính năng này thật sự cần thiết, hãy trình bày ở [Discussions → Ideas](${IDEAS_URL}).`,
].join('\n')
}
/** The item an `issues` or `pull_request_target` event is about, in `classify`'s shape. */
function itemOf(payload) {
const kind = payload.pull_request ? 'pull_request' : 'issue'
const raw = payload.pull_request ?? payload.issue
return {
kind,
number: raw.number,
title: raw.title ?? '',
labels: (raw.labels ?? []).map((l) => l.name),
association: raw.author_association ?? 'NONE',
authorIsBot: raw.user?.type === 'Bot',
state: raw.state,
addedLabel: payload.action === 'labeled' ? (payload.label?.name ?? null) : null,
}
}
/** Entry point for actions/github-script. */
async function run({ github, context, core }) {
if (context.eventName === 'workflow_dispatch') {
// A dry run: classify what the inputs describe and say so. Nothing is touched.
const inputs = context.payload.inputs ?? {}
const item = {
kind: inputs.kind === 'pull_request' ? 'pull_request' : 'issue',
title: inputs.title ?? '',
labels: (inputs.labels ?? '').split(',').map((s) => s.trim()).filter(Boolean),
association: inputs.association ?? 'NONE',
authorIsBot: false,
state: 'open',
addedLabel: null,
}
const verdict = classify(item)
core.notice(`${verdict.close ? 'would close' : 'would leave open'}: ${verdict.reason}`)
core.summary.addRaw(`**${verdict.close ? 'Would close' : 'Would leave open'}** — ${verdict.reason}`)
await core.summary.write()
return verdict
}
const item = itemOf(context.payload)
const verdict = classify(item)
core.info(`#${item.number}: ${verdict.close ? 'closing' : 'leaving open'} — ${verdict.reason}`)
if (!verdict.close) return verdict
const { owner, repo } = context.repo
await github.rest.issues.addLabels({
owner,
repo,
issue_number: item.number,
labels: [FEATURE_LABEL, OUT_OF_SCOPE],
})
await github.rest.issues.createComment({
owner,
repo,
issue_number: item.number,
body: comment(item.kind),
})
if (item.kind === 'pull_request') {
await github.rest.pulls.update({ owner, repo, pull_number: item.number, state: 'closed' })
} else {
await github.rest.issues.update({
owner,
repo,
issue_number: item.number,
state: 'closed',
state_reason: 'not_planned',
})
}
return verdict
}
module.exports = { classify, comment, itemOf, run, FEATURE_TITLE, FEAT_COMMIT }
+129
View File
@@ -0,0 +1,129 @@
// `node --test .github/scripts/*.test.cjs` — Node's built-in runner, as for scripts/*.test.mjs.
'use strict'
const assert = require('node:assert/strict')
const { test } = require('node:test')
const { classify, comment, itemOf } = require('./triage.cjs')
const base = {
kind: 'issue',
title: '',
labels: [],
association: 'NONE',
authorIsBot: false,
state: 'open',
addedLabel: null,
}
const item = (over) => ({ ...base, ...over })
test('a title that says it is a feature request is closed, in either language', () => {
for (const title of [
'[Feature] Dark/light theme toggle',
'[Feature request]: conda support',
'[Enhancement] faster search',
'[Request] macOS build',
'Feature request: export to Poetry',
'feature: portable mode',
'[Tính năng] Hỗ trợ conda',
'[Đề xuất tính năng] chế độ portable',
'Đề xuất tính năng: giao diện sáng',
]) {
assert.equal(classify(item({ title })).close, true, title)
}
})
test('a bug report is never closed, whatever words it uses', () => {
for (const title of [
'[Bug]: crash when adding an interpreter',
'The feature to roll back is broken',
'Rollback feature does nothing',
'Request timed out while searching',
'Enhancement of the dock bay stopped working after 1.6.0',
'[Accessibility]: Remove from list has no focus ring',
]) {
assert.equal(classify(item({ title })).close, false, title)
}
})
test('a pull request titled feat: is closed; fix:, docs: and build(deps): are not', () => {
for (const title of ['feat: conda envs', 'feat(ui): light theme', 'feat!: drop pip']) {
assert.equal(classify(item({ kind: 'pull_request', title })).close, true, title)
}
for (const title of ['fix(ui): focus ring', 'docs: typo', 'build(deps): Bump vite', 'i18n(vi): sửa lỗi chính tả']) {
assert.equal(classify(item({ kind: 'pull_request', title })).close, false, title)
}
// An issue titled like a commit is a person's wording, not a commit type.
assert.equal(classify(item({ kind: 'issue', title: 'feat: something' })).close, false)
})
test('putting the enhancement label on closes it; any other label does not', () => {
assert.equal(classify(item({ title: 'Make it faster', addedLabel: 'enhancement' })).close, true)
// A label event is about the label: a feature title already open and now labelled `bug` was
// let through when it was opened, and re-judging it on every label would close it late.
assert.equal(classify(item({ title: '[Feature] x', addedLabel: 'bug' })).close, false)
})
test('maintainers, bots and policy exceptions are never closed', () => {
for (const association of ['OWNER', 'MEMBER', 'COLLABORATOR']) {
assert.equal(classify(item({ title: '[Feature] x', association })).close, false, association)
}
assert.equal(classify(item({ kind: 'pull_request', title: 'feat: x', authorIsBot: true })).close, false)
assert.equal(
classify(item({ title: '[Feature] x', labels: ['policy-exception'], addedLabel: 'enhancement' })).close,
false,
)
})
test('what is closed or already handled is left alone', () => {
assert.equal(classify(item({ title: '[Feature] x', state: 'closed' })).close, false)
assert.equal(classify(item({ title: '[Feature] x', labels: ['out-of-scope'] })).close, false)
})
test('the answer is in both languages and says what kind of item it is', () => {
const pr = comment('pull_request')
assert.match(pr, /This pull request reads as a feature request/)
assert.match(pr, /Pull request này/)
assert.match(pr, /CONTRIBUTING\.md#scope-in-maintenance-mode/)
assert.match(comment('issue'), /This issue reads as a feature request/)
})
test('an event payload becomes an item, the added label included', () => {
const fromIssue = itemOf({
action: 'labeled',
label: { name: 'enhancement' },
issue: {
number: 7,
title: 'Make it faster',
labels: [{ name: 'triage' }, { name: 'enhancement' }],
author_association: 'NONE',
user: { type: 'User' },
state: 'open',
},
})
assert.deepEqual(fromIssue, {
kind: 'issue',
number: 7,
title: 'Make it faster',
labels: ['triage', 'enhancement'],
association: 'NONE',
authorIsBot: false,
state: 'open',
addedLabel: 'enhancement',
})
const fromPr = itemOf({
action: 'opened',
pull_request: {
number: 9,
title: 'feat: x',
labels: [],
author_association: 'FIRST_TIME_CONTRIBUTOR',
user: { type: 'User' },
state: 'open',
},
})
assert.equal(fromPr.kind, 'pull_request')
assert.equal(fromPr.addedLabel, null)
assert.equal(classify(fromPr).close, true)
})
+4 -3
View File
@@ -103,9 +103,10 @@ jobs:
with:
node-version: '26'
# The checker tests itself with Node's built-in runner, so it needs no dependency either.
- name: Test the checker
run: node --test scripts/*.test.mjs
# The repository's own CI scripts — this checker, and the maintenance-mode triage beside the
# workflows — test themselves with Node's built-in runner, so they need no dependency either.
- name: Test the CI scripts
run: node --test scripts/*.test.mjs .github/scripts/*.test.cjs
- name: Production dependencies under GPL-3.0-compatible licences
run: node scripts/check-licenses.mjs
+1
View File
@@ -31,6 +31,7 @@ on:
- Release
- Security scan
- SonarCloud
- Triage
types: [completed]
release:
types: [published]
+71
View File
@@ -0,0 +1,71 @@
# Maintenance-mode triage, from 1.6.0 (CONTRIBUTING.md, "Scope in maintenance mode").
#
# A feature request — titled as one, a `feat:` pull request, or labelled `enhancement` — is labelled
# `enhancement` and `out-of-scope`, answered in English and Vietnamese, and closed as not planned.
# Never one opened by a maintainer or a bot, or labelled `policy-exception`, the maintainer's way of
# keeping open a feature judged truly necessary. .github/scripts/triage.cjs holds the rules and says
# why they are only ever the unmistakable ones; its tests run in ci-node.yml's `npm licences` job.
#
# **`pull_request_target` checks out the base branch and nothing else.** That event runs with a
# write token even for a fork's pull request, which is the reason it is used here — a plain
# `pull_request` from a fork gets a read-only token and could not label or close anything — and
# exactly why nothing from the pull request is checked out or executed: the script reads the
# event's title and labels as data.
#
# `workflow_dispatch` is a dry run: it classifies the title and labels it is given and touches
# nothing, which is how the rules are tried without opening a public issue.
name: Triage
on:
issues:
types: [opened, labeled]
pull_request_target:
types: [opened, labeled]
workflow_dispatch:
inputs:
kind:
description: What to classify
type: choice
options: [issue, pull_request]
default: issue
title:
description: Its title
required: true
type: string
labels:
description: Its labels, comma-separated
required: false
type: string
default: ''
association:
description: The author's association
type: choice
options: [NONE, CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR, COLLABORATOR, MEMBER, OWNER]
default: NONE
permissions:
contents: read
jobs:
policy:
name: maintenance policy
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write # label, comment, close
pull-requests: write # the same on a pull request
steps:
- name: Checkout the base branch's scripts
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
sparse-checkout: .github/scripts
- name: Apply the policy
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const triage = require('./.github/scripts/triage.cjs')
await triage.run({ github, context, core })
+12 -1
View File
@@ -116,9 +116,20 @@ export default tseslint.config(
// `scripts/**` is here because `recommendedTypeChecked` above is unscoped: without this,
// adding one `.mjs` build script makes `eslint .` fail outright rather than report a lint.
{
files: ['*.js', '*.ts', 'scripts/**/*.{js,mjs}'],
files: ['*.js', '*.ts', 'scripts/**/*.{js,mjs}', '.github/scripts/**/*.{js,cjs,mjs}'],
...tseslint.configs.disableTypeChecked,
// Node globals: these run under node, not in the webview.
languageOptions: { globals: { console: 'readonly', process: 'readonly' } },
},
// The triage helper beside the workflows is CommonJS: actions/github-script loads it with
// `require`, and its test does the same so it tests what the workflow runs.
{
files: ['.github/scripts/**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
globals: { require: 'readonly', module: 'writable' },
},
rules: { '@typescript-eslint/no-require-imports': 'off' },
},
)