From a06ed7becba8640b476a897bef9d8418c73bfdbb Mon Sep 17 00:00:00 2001 From: sohitkumar Date: Mon, 7 Oct 2024 18:43:47 +0530 Subject: [PATCH] chore(DEV-106): pr_validation file added. --- .github/workflows/pr_validation.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/pr_validation.yml diff --git a/.github/workflows/pr_validation.yml b/.github/workflows/pr_validation.yml new file mode 100644 index 00000000..2adf7a5e --- /dev/null +++ b/.github/workflows/pr_validation.yml @@ -0,0 +1,27 @@ +name: PR Validation + +on: + pull_request: + types: [opened, edited] + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: Check PR Title and Description + run: | + title="${{ github.event.pull_request.title }}" + description="${{ github.event.pull_request.body }}" + + # Validate PR title + if [[ "$title" != *"feat"* ]] && \ + [[ "$title" != *"fix"* ]] && \ + [[ "$title" != *"refactor"* ]] && \ + [[ "$title" != *"style"* ]] && \ + [[ "$title" != *"chore"* ]]; then + echo "Error: Pull request title must include 'feat', 'fix', 'refactor', 'style' or 'chore'." + exit 1 + fi + + echo "Pull request title and description are valid."