From 8137c0c64bb46a2f32a3bcc34dcefdc975e4e9fe Mon Sep 17 00:00:00 2001 From: xdustinface Date: Sat, 21 Mar 2026 20:58:31 +0700 Subject: [PATCH] ci: remove `ready-for-review` label when `merge-conflict` is added Listen for `pull_request` `labeled` events and remove the `ready-for-review` label when `merge-conflict` is applied. --- .github/workflows/ready-for-review.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ready-for-review.yml b/.github/workflows/ready-for-review.yml index 650eea1ad..ab848dfeb 100644 --- a/.github/workflows/ready-for-review.yml +++ b/.github/workflows/ready-for-review.yml @@ -2,7 +2,7 @@ name: Ready for Review Label on: pull_request: - types: [ready_for_review] + types: [ready_for_review, labeled] pull_request_review: types: [submitted, dismissed] workflow_run: @@ -90,6 +90,7 @@ jobs: EVENT_ACTION: ${{ github.event.action }} REVIEW_STATE: ${{ github.event.review.state }} PR_NUMBER_DIRECT: ${{ github.event.pull_request.number }} + LABEL_NAME: ${{ github.event.label.name }} PULL_REQUESTS_JSON: ${{ toJson(github.event.workflow_run.pull_requests) }} run: | # On review dismissal or changes requested, remove label and exit @@ -101,6 +102,15 @@ jobs: fi fi + # On merge-conflict label, remove ready-for-review and exit + if [ "$EVENT_NAME" = "pull_request" ] && [ "$EVENT_ACTION" = "labeled" ]; then + if [ "$LABEL_NAME" = "merge-conflict" ]; then + echo "Merge conflict detected, removing ready-for-review label." + gh pr edit "$PR_NUMBER_DIRECT" --repo "$REPO" --remove-label "ready-for-review" || true + fi + exit 0 + fi + # Collect PR numbers depending on the event type if [ "$EVENT_NAME" = "workflow_run" ]; then PR_NUMBERS=$(echo "$PULL_REQUESTS_JSON" | jq -r '.[].number')