mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
* 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>
78 lines
3.1 KiB
YAML
78 lines
3.1 KiB
YAML
name: Pull Request Labeled
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [labeled]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
pull-request-labeled-backport-requested:
|
|
name: backport/requested label added
|
|
if: github.event.label.name == 'backport/requested 🗳'
|
|
runs-on: ubuntu-latest
|
|
permissions: {}
|
|
steps:
|
|
- name: Trigger Slack workflow
|
|
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
|
with:
|
|
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
|
|
webhook-type: webhook-trigger
|
|
payload: |
|
|
{
|
|
"base_ref": ${{ toJSON(github.event.pull_request.base.ref) }},
|
|
"title": ${{ toJSON(github.event.pull_request.title) }},
|
|
"url": ${{ toJSON(github.event.pull_request.html_url) }},
|
|
"user": ${{ toJSON(github.event.pull_request.user.login) }}
|
|
}
|
|
pull-request-labeled-deprecation-review-complete:
|
|
name: deprecation-review/complete label added
|
|
if: github.event.label.name == 'deprecation-review/complete ✅'
|
|
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.RELEASE_BOARD_GH_APP_CREDS }}
|
|
org: electron
|
|
- name: Set status
|
|
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
|
with:
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
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"
|