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 <dsanders11@ucsbalum.com>

* add pr autoclose

* replace with specific secret

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* specify repo

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* update wording of comment

* chore: use GH app token

* chore: fix indentation

---------

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
Michaela Laurencin
2026-01-29 13:12:42 -05:00
committed by GitHub
parent 0e161c18eb
commit 92a3f7d6c1

View File

@@ -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 -->
*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"