Skip to content

Commit

Permalink
Setup review-ready label synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 29, 2025
1 parent 047bbfa commit ed01697
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/review-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Sync review-ready label

on:
pull_request:
branches: [master]
types:
- labeled
- unlabeled
- opened
- edited
- closed
- reopened
- synchronize
- converted_to_draft
- ready_for_review
- review_requested
- review_request_removed
- auto_merge_enabled
- auto_merge_disabled


jobs:
label:
name: Sync review label
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
timeout-minutes: 5
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Ensure label exists
run: |
gh label create review-ready --color B2D89F --description "PR is ready for the review" --repo ${{ github.repository }} || true
- name: Sync label
run: |
ISDRAFT1=$(gh pr view ${{ github.event.pull_request.number }} --json isDraft --jq '.isDraft' --repo ${{ github.repository }})
ISDRAFT="$(echo -e "${ISDRAFT1}" | tr -d '[:space:]')"
echo "isdraft=$ISDRAFT"
if [[ "false" == "$ISDRAFT" ]]; then
echo "Set label"
gh pr edit ${{ github.event.pull_request.number }} --add-label review-ready --repo ${{ github.repository }}
else
echo "Remove label"
gh pr edit ${{ github.event.pull_request.number }} --remove-label review-ready --repo ${{ github.repository }}
fi

0 comments on commit ed01697

Please sign in to comment.