Skip to content

Commit

Permalink
check PR labels
Browse files Browse the repository at this point in the history
Signed-off-by: ozkanonur <[email protected]>
  • Loading branch information
onur-ozkan committed Jun 26, 2023
1 parent 08bfef7 commit 3bd9fbf
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ on:
types:
- opened
- edited
- reopened
- synchronize
- labeled
- unlabeled

jobs:
main:
name: Validate PR title
name: Validate PR
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
Expand Down Expand Up @@ -40,3 +43,26 @@ jobs:
echo "PR title is too long (greater than 72 characters)"
exit 1
fi
- name: Check PR labels
env:
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
under_review_is_used=false
in_progress_is_used=false
for label in $LABELS; do
if [[ "$label" == "under review" ]]; then
under_review_is_used=true
elif [[ "$label" == "in progress" ]]; then
in_progress_is_used=true
fi
done
if [ "$under_review_is_used" = true ] && [ "$in_progress_is_used" = true ]; then
echo "PR cannot have both 'under review' and 'in progress' labels at the same time."
exit 1
elif [ "$under_review_is_used" = false ] && [ "$in_progress_is_used" = false ]; then
echo "PR must have at least one of the labels 'under review' or 'in progress'."
exit 1
fi

0 comments on commit 3bd9fbf

Please sign in to comment.