From 92a3f7d6c104dc98956bf2a12e226e358a9ee0ee Mon Sep 17 00:00:00 2001 From: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com> Date: Thu, 29 Jan 2026 13:12:42 -0500 Subject: [PATCH] ci: add workflow for commenting with new 'ai-pr' label (#49564) * add workflow for commenting with new 'ai-pr' label * Update .github/workflows/pull-request-labeled.yml Co-authored-by: David Sanders * add pr autoclose * replace with specific secret Co-authored-by: David Sanders * specify repo Co-authored-by: David Sanders * update wording of comment * chore: use GH app token * chore: fix indentation --------- Co-authored-by: David Sanders --- .github/workflows/pull-request-labeled.yml | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/pull-request-labeled.yml b/.github/workflows/pull-request-labeled.yml index 1662057239..0c540cf165 100644 --- a/.github/workflows/pull-request-labeled.yml +++ b/.github/workflows/pull-request-labeled.yml @@ -44,3 +44,34 @@ jobs: project-number: 94 field: Status field-value: ✅ Reviewed + pull-request-labeled-ai-pr: + name: ai-pr label added + if: github.event.label.name == 'ai-pr' + runs-on: ubuntu-latest + permissions: {} + steps: + - name: Generate GitHub App token + uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0 + id: generate-token + with: + creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} + - name: Create comment + uses: actions-cool/issues-helper@e2ff99831a4f13625d35064e2b3dfe65c07a0396 # v3.7.5 + with: + actions: 'create-comment' + token: ${{ steps.generate-token.outputs.token }} + body: | + + + *AI PR Detected* + + Hello @${{ github.event.pull_request.user.login }}. Due to the high amount of AI spam PRs we receive, if a PR is detected to be majority AI-generated without disclosure and untested, we will automatically close the PR. + + We welcome the use of AI tools, as long as the PR meets our quality standards and has clearly been built and tested. If you believe your PR was closed in error, we welcome you to resubmit. However, please read our [CONTRIBUTING.md](http://contributing.md/) carefully before reopening. Thanks for your contribution. + - name: Close the pull request + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + GH_REPO: electron/electron + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + gh pr close "$PR_NUMBER"