impr(PR labels): automatically label PRs "waiting for review/update" (@sanidhyas3s) (#5830)

!nuf
This commit is contained in:
Sanidhya Singh 2024-08-29 17:47:04 +05:30 committed by GitHub
parent 253efb7340
commit 1ba4be38d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

58
.github/workflows/label-pr.yml vendored Normal file
View file

@ -0,0 +1,58 @@
name: Update PR labels
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [review_requested, review_request_removed]
pull_request_review:
types: [submitted]
issue_comment:
types: [created]
jobs:
update-pr-labels:
name: Update PR Labels Based on Events
runs-on: ubuntu-latest
steps:
- name: Remove "waiting for update" label if comment is by PR author or a review is requested
if: ${{ (github.event.issue.pull_request && github.event_name == 'issue_comment' && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action == 'review_requested') }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: waiting for update
env:
NUMBER: ${{ github.event.issue.number }}
- name: Add "waiting for review" if a review is requested
if: github.event.action == 'review_requested'
uses: actions-ecosystem/action-add-labels@v1
with:
labels: waiting for review
env:
NUMBER: ${{ github.event.pull_request.number }}
- name: Remove "waiting for review" label if review request is removed
if: github.event.action == 'review_request_removed'
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: waiting for review
env:
NUMBER: ${{ github.event.issue.number }}
- name: Add "waiting for update" if changes are requested
if: ${{(github.event_name == 'pull_request_review' && github.event.review.state == 'changes_requested')}}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: waiting for update
env:
NUMBER: ${{ github.event.pull_request.number }}
- name: Remove "waiting for review" label after review
if: ${{github.event_name == 'pull_request_review' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: waiting for review
env:
NUMBER: ${{ github.event.issue.number }}