From 16f9905bf743fdb1e0eb90671856642b5997a401 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Wed, 25 Sep 2024 13:13:19 +0300 Subject: [PATCH] Add GitHub actions check workflow --- .github/workflows/validate-branch-name.yml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/validate-branch-name.yml diff --git a/.github/workflows/validate-branch-name.yml b/.github/workflows/validate-branch-name.yml new file mode 100644 index 00000000..ff40b40d --- /dev/null +++ b/.github/workflows/validate-branch-name.yml @@ -0,0 +1,24 @@ +name: Branch Naming Convention Check + +on: + push: + branches-ignore: + - master + +jobs: + check-branch-name: + runs-on: ubuntu-latest + steps: + - name: Check branch name + run: | + branch_name=${{ github.ref_name }} + if [[ $branch_name == "master" ]]; then + echo "Branch is master, skipping check." + exit 0 + fi + if ! [[ $branch_name =~ ^(feature|bugfix|hotfix|documentation|refactor|other)/ ]]; then + echo "Branch name '$branch_name' does not follow the naming convention." + echo "It should start with one of: feature/, bugfix/, hotfix/, documentation/, refactor/, or other/" + echo "Example: feature/my-feature-name or bugfix/fix-issue-123" + exit 1 + fi \ No newline at end of file