From 21d146be7ed473a0e9b1f42cee243571da7aa134 Mon Sep 17 00:00:00 2001 From: ygowthamr Date: Thu, 17 Oct 2024 21:01:07 +0530 Subject: [PATCH] Added PrValidator github workflow --- .github/workflows/PRValidator.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/PRValidator.yml diff --git a/.github/workflows/PRValidator.yml b/.github/workflows/PRValidator.yml new file mode 100644 index 00000000..cd771f5f --- /dev/null +++ b/.github/workflows/PRValidator.yml @@ -0,0 +1,26 @@ +name: PR Description Check + +on: + pull_request: + types: [opened] + +jobs: + validate-pr-description: + runs-on: ubuntu-latest + steps: + - name: Validate PR Description + id: check_description + run: | + if [ -z "${{ github.event.pull_request.body }}" ]; then + echo "::error::Description is missing!" + exit 1 + fi + + - name: Check for issue number or 'Fixes #NEW' + id: check_issue_number + run: | + description="${{ github.event.pull_request.body }}" + if [[ ! "$description" =~ (Fixes #[0-9]+|Fixes #NEW) ]]; then + echo "::error::PR description must contain an issue number or 'Fixes #NEW'" + exit 1 + fi \ No newline at end of file