mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 03:50:30 +00:00
84df69c18a
The server build runs out of memory in tsc with the grouped updates. Back to the previous dependencies until the update that causes it is found.
95 lines
3.4 KiB
YAML
95 lines
3.4 KiB
YAML
name: Flag issues with bad titles
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
|
|
permissions:
|
|
issues: write
|
|
|
|
jobs:
|
|
check-title:
|
|
if: github.repository == 'liketrek/TREK'
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 45
|
|
steps:
|
|
- name: Flag or redirect issue
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
const title = context.payload.issue.title.trim();
|
|
const titleLower = title.toLowerCase();
|
|
|
|
const badTitles = [
|
|
"[bug]", "bug report", "bug", "issue",
|
|
"help", "question", "test", "...", "untitled"
|
|
];
|
|
|
|
const featureRequestTitles = [
|
|
"feature request", "[feature]", "[feature request]", "[enhancement]"
|
|
];
|
|
|
|
if (badTitles.includes(titleLower)) {
|
|
// Ensure the label exists
|
|
try {
|
|
await github.rest.issues.getLabel({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
name: 'invalid-title',
|
|
});
|
|
} catch {
|
|
await github.rest.issues.createLabel({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
name: 'invalid-title',
|
|
color: 'e4e669',
|
|
description: 'Issue title does not meet quality standards',
|
|
});
|
|
}
|
|
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.issue.number,
|
|
labels: ['invalid-title'],
|
|
});
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.issue.number,
|
|
body: [
|
|
'## Invalid title',
|
|
'',
|
|
`Your issue title \`${title}\` is too generic to be actionable.`,
|
|
'',
|
|
'Please edit the title to something descriptive that summarizes the problem — for example:',
|
|
'> _Map view crashes when zooming in on Safari 17_',
|
|
'',
|
|
'**This issue will be automatically closed in 24 hours if the title has not been updated.**',
|
|
].join('\n'),
|
|
});
|
|
|
|
} else if (featureRequestTitles.some(t => titleLower.startsWith(t))) {
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.issue.number,
|
|
body: [
|
|
'## Wrong place for feature requests',
|
|
'',
|
|
'Feature requests should be submitted in [Discussions](https://github.com/liketrek/TREK/discussions/new?category=feature-requests), not as issues.',
|
|
'',
|
|
'This issue has been closed. Feel free to re-submit your idea in the right place!',
|
|
].join('\n'),
|
|
});
|
|
|
|
await github.rest.issues.update({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.issue.number,
|
|
state: 'closed',
|
|
state_reason: 'not_planned',
|
|
});
|
|
}
|