diff --git a/.github/actions/send-ai-bot-comment/action.yml b/.github/actions/send-ai-bot-comment/action.yml index 1dcf376e3..8f0d04c0b 100644 --- a/.github/actions/send-ai-bot-comment/action.yml +++ b/.github/actions/send-ai-bot-comment/action.yml @@ -19,6 +19,8 @@ runs: env: INPUT_ISSUE_NUMBER: ${{ inputs.pr-number }} INPUT_BODY: | + + Hello @${{ inputs.login }}. Your PR has been labeled `maybe automated` because it appears to have been fully generated by AI with no human involvement. To keep your PR open, please follow these steps: @@ -28,21 +30,6 @@ runs: - Make sure it follows our [contribution guidelines](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md) and uses the correct [GitHub template](https://github.com/vitest-dev/vitest/blob/main/.github/PULL_REQUEST_TEMPLATE.md) - Disclose any AI tools you used (e.g. Claude, Copilot, Codex) - - Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like [Google Translate](https://translate.google.com/) or [Deepl](https://www.deepl.com/en/translator). If the response is generated, the PR will be closed automatically. *These measures help us reduce maintenance burden and keep the team's work efficient. See our [AI contributions policy](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md#ai-contributions) for more context.* diff --git a/.github/workflows/pr-labeled-automated.yml b/.github/workflows/pr-labeled-automated.yml index 38d1ddbb6..0e42f5b9e 100644 --- a/.github/workflows/pr-labeled-automated.yml +++ b/.github/workflows/pr-labeled-automated.yml @@ -13,31 +13,6 @@ concurrency: cancel-in-progress: true jobs: - prompt-label: - runs-on: ubuntu-slim - if: github.repository == 'vitest-dev/vitest' && contains(github.event.pull_request.body, '') - name: Automatic Clanker Alert - permissions: - contents: read # to check out the repo for local actions - pull-requests: write # comment and label on PRs - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - ref: main - - name: maybe automated (label) - uses: ./.github/actions/issues-helper - with: - actions: add-labels - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.pull_request.number }} - labels: maybe automated - - uses: ./.github/actions/send-ai-bot-comment - with: - token: ${{ secrets.GITHUB_TOKEN }} - pr-number: ${{ github.event.pull_request.number }} - login: ${{ github.event.pull_request.user.login }} - agentscan: runs-on: ubuntu-slim # run only for our repo and ignore PRs from origin that only maintainers can do @@ -67,13 +42,13 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} mode: labels trusted-author-associations: 'owner, collaborator, member' - label-automation: maybe automated + label-automation: bot label-mixed: maybe automated label-community-flagged: bot # agentscan-action puts a label automatically and we send a comment if the account looks suspicious - - name: Comment flagged PR - if: steps.agentscan.outputs.classification != 'organic' && steps.agentscan.outputs.community-flagged != 'true' + - name: Comment mixed accounts + if: steps.agentscan.outputs.classification == 'mixed' && steps.agentscan.outputs.community-flagged != 'true' uses: ./.github/actions/send-ai-bot-comment with: token: ${{ secrets.GITHUB_TOKEN }} @@ -81,13 +56,28 @@ jobs: login: ${{ github.event.pull_request.user.login }} # if the account is confirmed to be a bot, just close the PR - - name: Close community flagged accounts - if: steps.agentscan.outputs.community-flagged == 'true' + - name: Close flagged accounts + if: steps.agentscan.outputs.community-flagged == 'true' || steps.agentscan.outputs.classification == 'automation' uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + INPUT_BODY: | + + + Your account has been [automatically flagged](https://agentscan.tools/user/${{ github.event.pull_request.user.login }}) as likely to be created by a bot, LLM, or agent, + and will be automatically closed. If you believe this is a mistake, please reply to this comment and we will review it. + + *These measures help us reduce maintenance burden and keep the team's work efficient. See our [AI contributions policy](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md#ai-contributions) for more context.* with: script: | const prNumber = context.payload.pull_request.number; + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: process.env.INPUT_BODY, + }) + await github.rest.pulls.update({ owner: context.repo.owner, repo: context.repo.repo, diff --git a/AGENTS.md b/AGENTS.md index adb0101e6..a63c9b87c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -233,16 +233,6 @@ Other blocking CI jobs: PRs are squash-merged, so the PR title becomes the commit message. Nothing in CI enforces the format; follow `.github/commit-convention.md` yourself: `(): ` with type one of `feat|fix|docs|dx|refactor|perf|test|workflow|build|ci|chore|types|wip|release|deps`, subject at most 50 characters, lowercase, imperative, no trailing dot. -## PR Descriptions - -When creating a pull request, you MUST include the following HTML comment at the bottom of the PR description: - -``` - -``` - -This allows maintainers to identify AI-assisted PRs for triage. If the description doesn't have this comment, it will be closed automatically. - ## PR Limitations This repository has a limit of 1 PR if you don't have write access. DO NOT try to bypass it by creating draft PRs. If you cannot create a pull request, let a human know that you will not breach this repository's policy because it will ban the PR author in Vitest organisation.