mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-24 02:39:18 -05:00
* ci: add a new workflow to close AI-generated PRs This PR adds a workflow to automatically close the PRs with too much AI-generated code. * fix: apply review comments
60 lines
2.9 KiB
YAML
60 lines
2.9 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
name: 'AI-generated pull requests'
|
|
|
|
on:
|
|
pull_request:
|
|
types: [labeled, unlabeled, reopened]
|
|
|
|
permissions:
|
|
pull-requests: read
|
|
|
|
jobs:
|
|
ai-generated-support:
|
|
if: github.event.label.name == 'ai-generated' || github.event.action == 'reopened'
|
|
runs-on: ubuntu-24.04
|
|
concurrency:
|
|
group: support-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
permissions:
|
|
pull-requests: write
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
NUMBER: ${{ github.event.pull_request.number }}
|
|
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
|
steps:
|
|
- name: Label added, comment and close pull request
|
|
if: github.event.action == 'labeled' && github.event.label.name == 'ai-generated'
|
|
shell: bash
|
|
env:
|
|
BODY: >
|
|
:wave: @${{ env.PR_AUTHOR }}, thank you for your contribution!
|
|
|
|
However, this pull request has been closed because it appears to contain a significant amount of AI-generated code without sufficient human review or supervision.
|
|
|
|
AI-generated code can often introduce subtle bugs, poor design patterns, or inconsistent styles that make long-term maintenance difficult and reduce overall code quality. For the sake of the project's future stability and readability, we require that all contributions meet our established coding standards and demonstrate clear developer oversight.
|
|
|
|
This pull request is also too large for effective human review. Please discuss with us on how to break down these changes into smaller, more focused PRs to ensure a thorough and efficient review process.
|
|
If you'd like to revise and resubmit your changes with careful review and cleanup, we'd be happy to take another look.
|
|
run: |
|
|
retry() { n=0; until "$@"; do n=$((n+1)); [ $n -ge 3 ] && break; echo "retry $n: $*" >&2; sleep 2; done; }
|
|
retry gh pr comment "$NUMBER" -R "$GH_REPO" -b "$BODY" || true
|
|
retry gh pr close "$NUMBER" -R "$GH_REPO" || true
|
|
gh pr lock "$NUMBER" -R "$GH_REPO" -r "spam" || true
|
|
|
|
- name: Reopened or label removed, unlock pull request
|
|
if: github.event.action == 'unlabeled' && github.event.label.name == 'ai-generated'
|
|
shell: bash
|
|
run: |
|
|
retry() { n=0; until "$@"; do n=$((n+1)); [ $n -ge 3 ] && break; echo "retry $n: $*" >&2; sleep 2; done; }
|
|
retry gh pr reopen "$NUMBER" -R "$GH_REPO" || true
|
|
gh pr unlock "$NUMBER" -R "$GH_REPO" || true
|
|
|
|
- name: Remove AI-generated label on manual reopen
|
|
if: github.event.action == 'reopened'
|
|
shell: bash
|
|
run: |
|
|
gh pr edit "$NUMBER" -R "$GH_REPO" --remove-label "ai-generated" || true
|
|
gh pr unlock "$NUMBER" -R "$GH_REPO" || true
|