From f0d390cb21d8dfd99663f00039748aed0c2be1b0 Mon Sep 17 00:00:00 2001 From: siri-chandana-macha Date: Tue, 22 Oct 2024 19:29:43 +0530 Subject: [PATCH] Added pr-checker --- .github/workflows/pr-checker.yml | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/pr-checker.yml diff --git a/.github/workflows/pr-checker.yml b/.github/workflows/pr-checker.yml new file mode 100644 index 00000000..2f55a8c2 --- /dev/null +++ b/.github/workflows/pr-checker.yml @@ -0,0 +1,34 @@ +name: PR Issue Checker + +on: + pull_request: + types: [opened, edited] + +jobs: + check_pr_description: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Check PR Description + id: check_pr_description + run: | + PR_DESCRIPTION="${{ github.event.pull_request.body }}" + if [[ -z "$PR_DESCRIPTION" ]]; then + echo "PR description is missing." + exit 1 + fi + + # Allow any text before # + if [[ ! "$PR_DESCRIPTION" =~ .*\ #[0-9]+ ]]; then + echo "The PR description should include the issue number assigned to you.⚠️" + echo "##[error]An issue reference like 'Fixed #' must be included in the description." + exit 1 + fi + + echo "PR description is valid." + + - name: Output result + run: echo "All checks passed." \ No newline at end of file