From bcc1fa87f54b1417dc999a2bb7001cd2f5d7560a Mon Sep 17 00:00:00 2001 From: Patricia Hillebrandt Date: Mon, 31 Jul 2023 15:54:17 +0200 Subject: [PATCH] Add new GH Action for ensuring the correct labels are added to PRs (#10412) * Add new GH Action for ensuring the correct labels are added to PRs. * Update Pull Request Template instructions for labels. * Update validation. * Update the validation for the type. --- .github/pull_request_template.md | 1 + .github/workflows/pr-label-validation.yml | 24 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/pr-label-validation.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3ce0c5026d7..a21d8e7640d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -18,6 +18,7 @@ Fixes # #### Other Checks +- [ ] This PR has either a `[type]` label or a `[skip-changelog]` label. - [ ] This PR adds/removes a feature flag & I've updated [this doc](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/docs/internal-developers/blocks/feature-flags-and-experimental-interfaces.md). - [ ] This PR adds/removes an experimental interfaces and I've updated [this doc](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/docs/internal-developers/blocks/feature-flags-and-experimental-interfaces.md). - [ ] I tagged two reviewers because this PR makes queries to the database or I think it might have some security impact. diff --git a/.github/workflows/pr-label-validation.yml b/.github/workflows/pr-label-validation.yml new file mode 100644 index 00000000000..bed1eb4b442 --- /dev/null +++ b/.github/workflows/pr-label-validation.yml @@ -0,0 +1,24 @@ +name: Pull Request Label Validation + +on: + pull_request: + branches: + - trunk + types: + - labeled + - unlabeled + - opened + - reopened + - synchronize + - edited + +env: + LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }} + +jobs: + check-type-label: + name: Check [Type] Label + runs-on: ubuntu-latest + steps: + - if: contains( env.LABELS, 'type' ) == false && contains( env.LABELS, 'skip-changelog' ) == false + run: exit 1