-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup review-ready label synchronization
Committed via https://github.com/asottile/all-repos
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |