Skip to content

Commit

Permalink
gha: add pr-validation GH action
Browse files Browse the repository at this point in the history
This action validates PRs based on labels.
It blocks PRs that have a dont-merge/* label, and blocks PRs that do not
have a release-note/* labe.

Signed-off-by: Kornilios Kourtis <[email protected]>
  • Loading branch information
kkourt committed Aug 28, 2023
1 parent 1f0427f commit c6abdb8
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pr

on:
pull_request:
branches:
- main
- v*
types:
- opened
- reopened
- synchronize
- edited
- ready_for_review
- labeled
- unlabeled

env:
LABELS: ${{ join(github.event.pull_request.labels.*.name, ' ') }}

jobs:
# based on https://github.com/WordPress/performance/blob/trunk/.github/workflows/pr-validation.yml
labels:
name: validate labels
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: release-note/*
if: always() && !contains(env.LABELS, 'release-note/')
run: |
echo "please add a release-note/* label to the pull request"
exit 1
- name: dont-merge/*
if: always() && contains(env.LABELS, 'dont-merge/')
run: |
echo "pull request has a dont-merge label"
exit 1

0 comments on commit c6abdb8

Please sign in to comment.