Files
AntennaPod/.github/workflows/issue-opened.yml
Hans-Peter Lehmann 6c69e0db15 Enforce issue template and reject issue assignment automatically (#8572)
### Description

We are receiving a lot of AI generated issues recently.
- Automatically apply the corresponding labels if they are missing
- Strengthen the AI instructions
- Close issues that do not follow the issue template (leaving a comment)
- While at it, also leave a comment when someone wants to be assigned to
an issue

### Checklist
<!-- 
To help us keep the issue tracker clean and work as efficient as
possible,
  please make sure that you have done all of the following.
You can tick the boxes below by placing an x inside the brackets like
this: [x]
-->
- [x] I have read the contribution guidelines:
https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md#submit-a-pull-request
- [x] I have performed a self-review of my code, going through my
changes line by line and carefully considering why this line change is
necessary
- [x] I have run the automated code checks using `./gradlew checkstyle
lint`
- [x] My code follows the style guidelines of the AntennaPod project:
https://antennapod.org/contribute/develop/app/code-style
- [x] I have mentioned the corresponding issue and the relevant keyword
(e.g., "Closes: #xy") in the description (see
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
- [x] If it is a core feature, I have added automated tests
2026-07-06 17:56:13 +02:00

55 lines
2.0 KiB
YAML

name: Issue opened
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
issue-opened:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
with:
script: |
const body = context.payload.issue.body || '';
const isBugReport = body.includes('### Steps to reproduce') || body.includes('### App version');
const isFeatureRequest = body.includes('### Feature or improvement you want');
const existingLabels = context.payload.issue.labels.map(l => l.name);
const addMissing = async (labels) => {
const missing = labels.filter(l => !existingLabels.includes(l));
if (missing.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: missing,
});
}
};
if (isBugReport) {
await addMissing(['Type: Possible bug']);
} else if (isFeatureRequest) {
await addMissing(['Needs: Triage', 'Type: Feature request']);
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: 'Please use one of the issue templates when opening an issue. '
+ 'You can find them at https://github.com/AntennaPod/AntennaPod/issues/new/choose\n\n'
+ 'This issue has been closed automatically.',
});
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',
});
}