Skip to content

ci: refine PR template and add PR submission checks#4076

Open
seefs001 wants to merge 1 commit intoQuantumNous:mainfrom
seefs001:ci/add-pr-check
Open

ci: refine PR template and add PR submission checks#4076
seefs001 wants to merge 1 commit intoQuantumNous:mainfrom
seefs001:ci/add-pr-check

Conversation

@seefs001
Copy link
Copy Markdown
Collaborator

@seefs001 seefs001 commented Apr 3, 2026

优化PR模版,引入对缺乏人工参与的AI Slop检查。

合并前需要先设置github action的环境变量

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

Walkthrough

Updates the PR template with stricter submission guidance requiring Issue associations for bug fixes and new features, adds anti-AI-slop recommendations, and implements a new GitHub Actions workflow to automatically enforce PR quality standards including template validation, anti-spam detection, and minimum account age checks.

Changes

Cohort / File(s) Summary
PR Template Updates
.github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Replaced warning section with [!IMPORTANT] callout, adjusted Description instructions to emphasize understanding over copy-pasting, added Issue association requirements to Bug fix and New feature checkboxes, expanded Checklist with duplicate submission checks, Bug fix labeling guidance, and updated manual validation phrasing.
PR Quality Enforcement Workflow
.github/workflows/pr-check.yml
New GitHub Actions workflow (pr-quality) triggered on PR open/reopen, executes anti-slop checks via peakoss/anti-slop@v0.2.1 requiring PR descriptions, strict template validation, and spam/AI-slop detection; applies pr-check-failed label and closes PR on failure.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • chore: refine PR template #3287: Modifies the same PR template file (.github/PULL_REQUEST_TEMPLATE/pull_request_template.md) with overlapping structural and guidance updates.

Poem

🐰 A template so strict, a workflow so keen,
No slop shall slip through, if you know what I mean!
With anti-spam guards and checks all in place,
Only quality PRs will show their fair face.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: refining the PR template and adding a new PR submission check workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/pr-check.yml:
- Around line 9-10: The pull_request_target trigger currently only lists types:
[opened, reopened]; update the pull_request_target types array to also include
synchronize and edited so the workflow runs when new commits are pushed to a PR
or its title/description is changed (i.e., change the types value on
pull_request_target to include "synchronize" and "edited" alongside "opened" and
"reopened").
- Line 16: Replace the mutable tag usage "peakoss/anti-slop@v0.2.1" with the
action's immutable full commit SHA to eliminate supply-chain risk; locate the
step that uses peakoss/anti-slop in the pull_request_target workflow (note the
workflow has pull-requests: write permission) and update the reference to
"peakoss/anti-slop@<full-commit-sha>" where <full-commit-sha> is the exact
40-character commit hash from the action repository's commit you want to pin.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: da4138e7-5adf-4d16-9d79-7059ac8552fa

📥 Commits

Reviewing files that changed from the base of the PR and between c9611c4 and f57644b.

📒 Files selected for processing (2)
  • .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
  • .github/workflows/pr-check.yml

Comment on lines +9 to +10
pull_request_target:
types: [opened, reopened]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cd .github/workflows && ls -la

Repository: QuantumNous/new-api

Length of output: 576


🏁 Script executed:

cat -n .github/workflows/pr-check.yml | head -20

Repository: QuantumNous/new-api

Length of output: 519


🌐 Web query:

GitHub Actions pull_request_target event types documentation

💡 Result:

The pull_request_target event in GitHub Actions triggers workflows on pull request activity (similar to pull_request), but runs in the context of the base branch (target branch) of the pull request, using the workflow file from the base branch. This grants access to repository secrets and a read/write GITHUB_TOKEN, even for PRs from forks, enabling actions like labeling or commenting on PRs. Supported activity types (triggering actions) are the same as pull_request: by default opened, synchronize, reopened. All pull_request types are supported, including assigned, unassigned, review_requested, review_request_removed, labeled, unlabeled, closed, etc. Specify with types: to limit. Example: on: pull_request_target: types: [opened, synchronize, reopened] Official documentation: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target (results 3,5). Security note: Use cautiously; do not checkout untrusted PR code without safeguards, as it has elevated permissions.

Citations:


Add missing event types to re-run checks on PR updates.

The current configuration only triggers on opened and reopened, but omits synchronize (new commits) and edited (description/title changes). This prevents automatic validation of important updates to pull requests, weakening code quality enforcement.

🔧 Suggested update
 on:
   pull_request_target:
-    types: [opened, reopened]
+    types: [opened, reopened, edited, synchronize, ready_for_review]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-check.yml around lines 9 - 10, The pull_request_target
trigger currently only lists types: [opened, reopened]; update the
pull_request_target types array to also include synchronize and edited so the
workflow runs when new commits are pushed to a PR or its title/description is
changed (i.e., change the types value on pull_request_target to include
"synchronize" and "edited" alongside "opened" and "reopened").

pr-quality:
runs-on: ubuntu-latest
steps:
- uses: peakoss/anti-slop@v0.2.1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Verify whether any workflow actions are pinned by mutable refs (tags/branches)
rg -n '^\s*-?\s*uses:\s+[^@]+@(v[0-9].*|main|master)$' .github/workflows/*.yml .github/workflows/*.yaml || true
# Expected after fix: no matches for mutable refs in security-sensitive workflows.

Repository: QuantumNous/new-api

Length of output: 1033


🏁 Script executed:

cat .github/workflows/pr-check.yml

Repository: QuantumNous/new-api

Length of output: 1254


🌐 Web query:

peakoss/anti-slop v0.2.1 commit hash SHA github

💡 Result:

The commit hash (short SHA) for peakoss/anti-slop v0.2.1 is 85daca1. This is the commit to which the v0.2.1 tag points, as shown on the GitHub tags and releases pages. The full SHA is not explicitly listed in the search results, but GitHub typically displays the first 7 characters as the short SHA, and 85daca1 is consistently associated with this release across official GitHub pages. The commit is signed by peaklabs-dev and titled "chore(release): v0.2.1". View it at peakoss/anti-slop@85daca1.

Citations:


Pin third-party action to a full commit SHA.

Line 16 references peakoss/anti-slop@v0.2.1 by tag. In a pull_request_target workflow with pull-requests: write permission, this is a supply-chain risk. Tags are mutable and can be re-tagged with malicious code. Pin to an immutable commit SHA instead.

🔒 Suggested update
-      - uses: peakoss/anti-slop@v0.2.1
+      - uses: peakoss/anti-slop@85daca1 # pin release immutably
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-check.yml at line 16, Replace the mutable tag usage
"peakoss/anti-slop@v0.2.1" with the action's immutable full commit SHA to
eliminate supply-chain risk; locate the step that uses peakoss/anti-slop in the
pull_request_target workflow (note the workflow has pull-requests: write
permission) and update the reference to "peakoss/anti-slop@<full-commit-sha>"
where <full-commit-sha> is the exact 40-character commit hash from the action
repository's commit you want to pin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant