From 4a0f97f201c576d085cdbaddc12802c9a387ac68 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Thu, 3 Oct 2024 14:08:22 +0300 Subject: [PATCH] Validates pull requests aimed at master to follow established branch naming conventions --- .../validate-pull-request-source-branch.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/validate-pull-request-source-branch.yml diff --git a/.github/workflows/validate-pull-request-source-branch.yml b/.github/workflows/validate-pull-request-source-branch.yml new file mode 100644 index 00000000..bd378bd6 --- /dev/null +++ b/.github/workflows/validate-pull-request-source-branch.yml @@ -0,0 +1,20 @@ +name: PR Source Branch Check + +on: + pull_request: + branches: + - master + +jobs: + check-branch-name: + runs-on: ubuntu-latest + steps: + - name: Check source branch name + run: | + branch_name=${{ github.head_ref }} + if ! [[ $branch_name =~ ^(feature|bugfix|hotfix|documentation|refactor|other)/ ]]; then + echo "Error: Branch name '$branch_name' does not follow the naming convention." + echo "It should start with one of: feature/, bugfix/, hotfix/, documentation/, refactor/, or other/" + exit 1 + fi + echo "Branch name '$branch_name' follows the correct naming convention." \ No newline at end of file