Skip to content

Commit

Permalink
ci(pr-validation): check PR labels (#1881)
Browse files Browse the repository at this point in the history
This commit adds label validation on PRs. The validation will only succeed if one of the following labels is used but not both: `under review` or `in progress`.

---------

Signed-off-by: ozkanonur <[email protected]>
  • Loading branch information
onur-ozkan authored Jun 26, 2023
1 parent 7388372 commit 8f3d8f2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 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,13 @@ jobs:
echo "PR title is too long (greater than 72 characters)"
exit 1
fi
- name: Check PR labels
if: >
(contains(toJson(github.event.pull_request.labels.*.name), 'under review') == false &&
contains(toJson(github.event.pull_request.labels.*.name), 'in progress') == false) ||
(contains(toJson(github.event.pull_request.labels.*.name), 'under review') == true &&
contains(toJson(github.event.pull_request.labels.*.name), 'in progress') == true)
run: |
echo "PR must have "exactly one" of these labels: [ 'under review', 'in progress' ]."
exit 1

0 comments on commit 8f3d8f2

Please sign in to comment.