diff --git a/.github/workflows/issue-comment.yml b/.github/workflows/issue-comment.yml new file mode 100644 index 000000000..43bdc51fa --- /dev/null +++ b/.github/workflows/issue-comment.yml @@ -0,0 +1,29 @@ +name: Issue comment + +on: + issue_comment: + types: [created] + +permissions: + issues: write + +jobs: + issue-comment: + if: github.event.issue.pull_request == null + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v8 + with: + script: | + const body = context.payload.comment.body || ''; + const assignmentRequest = /\b(please|can|could|would)\b.{0,40}\bassign\b|\bassign (me|this|it)\b|\bbe assigned\b/i; + if (!assignmentRequest.test(body)) return; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.issue.number, + body: 'Thanks for your interest! It looks like you asked to be assigned to this issue. ' + + 'We do not assign issues. Anyone is free to open a pull request at any time. ' + + 'Please have a look at our [contribution guidelines](https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md) before getting started.', + }); diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml new file mode 100644 index 000000000..f30af0f4f --- /dev/null +++ b/.github/workflows/issue-opened.yml @@ -0,0 +1,54 @@ +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', + }); + } diff --git a/AGENTS.md b/AGENTS.md index bb149a53c..fefa4bdf2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -103,4 +103,6 @@ Never create commits directly on the `develop` or `master` branch. Always checko # Issue Conventions When creating an issue, always follow one of the issue templates in `.github/ISSUE_TEMPLATE/`. -Apply the corresponding labels and always mention in the technical info box that the issue was AI generated. +Apply the corresponding labels that are marked in the issue template yaml file. +Always mention in the technical info box that the issue was AI generated. +If you do not follow these, the issue gets closed automatically.