From 6b1cdbb303e5d9e0a0c4639f3159ed8876d9a36c Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Tue, 13 Aug 2024 14:08:53 +0200 Subject: [PATCH 1/6] chore(ci): check on branch name --- .github/workflows/BRANCH_NAME_CHECK_ON_PR.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/BRANCH_NAME_CHECK_ON_PR.yml diff --git a/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml b/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml new file mode 100644 index 0000000000..a9d2e8a138 --- /dev/null +++ b/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml @@ -0,0 +1,22 @@ +on: + pull_request: + branches: + - main + - master + +jobs: + check-branch-name: + runs-on: ubuntu-latest + steps: + - name: Extract branch name + id: extract_branch + run: echo "::set-output name=branch::${GITHUB_HEAD_REF}" + - name: Check if branch name follows conventional commit regex + run: | + BRANCH_REGEX='^(feat|fix|docs|style|refactor|perf|test|chore)\(?.+\)?: .+$' + if [[ "${{ steps.extract_branch.outputs.branch }}" =~ $BRANCH_REGEX ]]; then + echo "Branch name follows the conventional commit format." + else + echo "Branch name does not follow the conventional commit format." + exit 1 + fi \ No newline at end of file From 07a93e9d175d2abc30e4583de35f7b275ae2abbd Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Tue, 13 Aug 2024 14:13:12 +0200 Subject: [PATCH 2/6] chore(ci): check on branch name 2 --- .github/workflows/BRANCH_NAME_CHECK_ON_PR.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml b/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml index a9d2e8a138..b0564141c8 100644 --- a/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml +++ b/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml @@ -14,6 +14,7 @@ jobs: - name: Check if branch name follows conventional commit regex run: | BRANCH_REGEX='^(feat|fix|docs|style|refactor|perf|test|chore)\(?.+\)?: .+$' + echo ${{steps.extract_branch.outputs.branch}} if [[ "${{ steps.extract_branch.outputs.branch }}" =~ $BRANCH_REGEX ]]; then echo "Branch name follows the conventional commit format." else From 2e5462c6491c59cd4ac11a024e91e28f530beb15 Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Tue, 13 Aug 2024 14:16:09 +0200 Subject: [PATCH 3/6] chore(ci): check on branch name 3 --- .github/workflows/BRANCH_NAME_CHECK_ON_PR.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml b/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml index b0564141c8..d62c850a3e 100644 --- a/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml +++ b/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml @@ -10,14 +10,13 @@ jobs: steps: - name: Extract branch name id: extract_branch - run: echo "::set-output name=branch::${GITHUB_HEAD_REF}" + run: echo "${{ github.event.pull_request.title }}" - name: Check if branch name follows conventional commit regex run: | BRANCH_REGEX='^(feat|fix|docs|style|refactor|perf|test|chore)\(?.+\)?: .+$' - echo ${{steps.extract_branch.outputs.branch}} - if [[ "${{ steps.extract_branch.outputs.branch }}" =~ $BRANCH_REGEX ]]; then - echo "Branch name follows the conventional commit format." + if [[ "${{ github.event.pull_request.title }}" =~ $BRANCH_REGEX ]]; then + echo "Pull request name follows the conventional commit format." else - echo "Branch name does not follow the conventional commit format." + echo "Pull request does not follow the conventional commit format." exit 1 fi \ No newline at end of file From 26865d64dd52246091eeb8aac431504107b0afa8 Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Tue, 13 Aug 2024 14:30:35 +0200 Subject: [PATCH 4/6] chore(ci): check on branch name 4 --- ...K_ON_PR.yml => PULL_REQUEST_NAME_CHECK_ON_PR.yml} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename .github/workflows/{BRANCH_NAME_CHECK_ON_PR.yml => PULL_REQUEST_NAME_CHECK_ON_PR.yml} (54%) diff --git a/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml b/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml similarity index 54% rename from .github/workflows/BRANCH_NAME_CHECK_ON_PR.yml rename to .github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml index d62c850a3e..64726b5e7b 100644 --- a/.github/workflows/BRANCH_NAME_CHECK_ON_PR.yml +++ b/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml @@ -5,16 +5,16 @@ on: - master jobs: - check-branch-name: + check-pull-request-name: runs-on: ubuntu-latest steps: - - name: Extract branch name - id: extract_branch + - name: Extract pull request name + id: extract_pr run: echo "${{ github.event.pull_request.title }}" - - name: Check if branch name follows conventional commit regex + - name: Check if pull request name follows conventional commit regex run: | - BRANCH_REGEX='^(feat|fix|docs|style|refactor|perf|test|chore)\(?.+\)?: .+$' - if [[ "${{ github.event.pull_request.title }}" =~ $BRANCH_REGEX ]]; then + PR_REGEX='^(feat|fix|docs|style|refactor|perf|test|chore)\(?.+\)?: .+$' + if [[ "${{ github.event.pull_request.title }}" =~ $PR_REGEX ]]; then echo "Pull request name follows the conventional commit format." else echo "Pull request does not follow the conventional commit format." From 81956aa2e1de33fd1c90369a17c242762fe4405a Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Tue, 13 Aug 2024 14:33:11 +0200 Subject: [PATCH 5/6] chore(ci): check on branch name 5 --- .github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml b/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml index 64726b5e7b..3614f15617 100644 --- a/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml +++ b/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml @@ -3,6 +3,7 @@ on: branches: - main - master + types: [opened, synchronize, reopened, edited] jobs: check-pull-request-name: From 9351fb0cede4c88ddefc3168428b0b8cd109bbe2 Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Wed, 14 Aug 2024 09:05:19 +0200 Subject: [PATCH 6/6] Update .github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml Co-authored-by: Simon --- .github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml b/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml index 3614f15617..6a0889961e 100644 --- a/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml +++ b/.github/workflows/PULL_REQUEST_NAME_CHECK_ON_PR.yml @@ -2,7 +2,6 @@ on: pull_request: branches: - main - - master types: [opened, synchronize, reopened, edited] jobs: