From 086b787d2c16e17c95fe39ea377b8af78feed79e Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Thu, 2 Dec 2021 17:51:10 +0400 Subject: [PATCH] More readable regex. Signed-off-by: Aleksandr --- .github/workflows/iroha2-dev-pr-title.yml | 33 ++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/iroha2-dev-pr-title.yml b/.github/workflows/iroha2-dev-pr-title.yml index 6a65f99e367..95ebf7f4d8f 100644 --- a/.github/workflows/iroha2-dev-pr-title.yml +++ b/.github/workflows/iroha2-dev-pr-title.yml @@ -9,10 +9,37 @@ jobs: check_pr_title: runs-on: ubuntu-latest steps: - - name: Check PR title format + - name: Check PR for Feature env: PR_TITLE: ${{ github.event.pull_request.title }} # Example: "[feature] #1: Some new feature" run: | - echo "$PR_TITLE" | grep -Eq '^\[(feature|fix|refactor)\] \#[[:digit:]]+:.+$' - || echo "PR_TITLE" | grep -Eq + echo "$PR_TITLE" | grep -Eqi '^\[(feature|feat\.?)\] \#?([[:digit:]]+|\(([[:digit:]]+,?\s?)+\)):.+$' + - name: Check for bugfix + if: failed() + env: + PR_TITLE: ${{ github.event.pull_request.title }} + # Example: "[fix] #1: Some new feature" + run: | + || echo "$PR_TITLE" | grep -Eqi '^\[(bug)?fix(up)?\] \#?([[:digit:]]+|\(([[:digit:]]+,?\s?)+\)):.+$' + - name: Check for refactor + if: failed() + env: + PR_TITLE: ${{ github.event.pull_request.title }} + # Example: "[refactor] #1: Some refactor" + run: | + || echo "$PR_TITLE" | grep -Eqi '^\[ref(actor)?\]( \#?([[:digit:]]+|\(([[:digit:]]+,?\s?)+\)):)?.+$' + - name: Check for CI + if: failed() + env: + PR_TITLE: ${{ github.event.pull_request.title }} + # Example: "[refactor] #1: Some refactor" + run: | + || echo "$PR_TITLE" | grep -Eqi '^\[ci\]( \#?([[:digit:]]+|\(([[:digit:]]+,?\s?)+\)):)?.+$' + - name: Check for Documentation + if: failed() + env: + PR_TITLE: ${{ github.event.pull_request.title }} + # Example: "[refactor] #1: Some refactor" + run: | + || echo "$PR_TITLE" | grep -Eqi '^\[doc(s|\]( \#?([[:digit:]]+|\(([[:digit:]]+,?\s?)+\)):)?.+$'