From 02e3bfde2e5213e39ee73ebd368d94fc2c8b8a94 Mon Sep 17 00:00:00 2001 From: saisravani20 Date: Fri, 23 May 2025 23:37:00 +0530 Subject: [PATCH 1/3] Update regex to handle markdown --- .github/workflows/validate-description.yml | 4 +++- checks/check_pr_description.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-description.yml b/.github/workflows/validate-description.yml index 5f3750c..c0fb991 100644 --- a/.github/workflows/validate-description.yml +++ b/.github/workflows/validate-description.yml @@ -14,6 +14,8 @@ jobs: repository: devrev/global-gh-tools path: .global-checks-tooling - name: Check PR description for work item link + env: + PR_BODY: ${{ github.event.pull_request.body }} run: | echo "Checking PR description for work item link" - python .global-checks-tooling/checks/check_pr_description.py "${{ github.event.pull_request.body }}" + python .global-checks-tooling/checks/check_pr_description.py "$PR_BODY" diff --git a/checks/check_pr_description.py b/checks/check_pr_description.py index 1f2b04c..32b0bc3 100644 --- a/checks/check_pr_description.py +++ b/checks/check_pr_description.py @@ -6,7 +6,7 @@ def check_description(description): Checks if the PR description contains a work item link. Returns True if valid, False otherwise. """ - regex = r"(^|\s)(https:\/\/app\.devrev\.ai\/devrev\/works\/)?(ISS|TKT|TASK)-\d+\b" + regex = r"(^|\s|\[)(https:\/\/app\.devrev\.ai\/devrev\/works\/)?(ISS|TKT|TASK)-\d+\b" return bool(re.search(regex, description)) def check_description_cli(description): From c7af123b2c4b844cdfbf692fad6658e49a999627 Mon Sep 17 00:00:00 2001 From: saisravani20 Date: Sat, 24 May 2025 00:10:44 +0530 Subject: [PATCH 2/3] add more lowercase --- checks/check_pr_description.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/checks/check_pr_description.py b/checks/check_pr_description.py index 32b0bc3..3894d5f 100644 --- a/checks/check_pr_description.py +++ b/checks/check_pr_description.py @@ -7,14 +7,15 @@ def check_description(description): Returns True if valid, False otherwise. """ regex = r"(^|\s|\[)(https:\/\/app\.devrev\.ai\/devrev\/works\/)?(ISS|TKT|TASK)-\d+\b" - return bool(re.search(regex, description)) + return bool(re.search(regex, description, re.IGNORECASE)) def check_description_cli(description): """ CLI version that prints messages and exits. """ if not check_description(description): - print("PR description must include a link to the work item (e.g., ISS-123, TKT-456, TASK-789, or a full https://app.devrev.ai/devrev/works/ISS-123 link).") + print("PR description must include a link to the work item (e.g., ISS-123, iss-123, TKT-456, tkt-456, TASK-789, task-789, or a full https://app.devrev.ai/devrev/works/ISS-123 link).") + print("Note: If using formats like 'work-item:ISS-123', make sure to add a space after the colon: 'work-item: ISS-123'") sys.exit(1) print("PR description contains a valid work item link.") sys.exit(0) From f045f1e3db5ba57c36fb24fbb1c99d100fcca61c Mon Sep 17 00:00:00 2001 From: Nghia Nguyen Date: Fri, 23 May 2025 12:00:18 -0700 Subject: [PATCH 3/3] don't need PR body env var --- .github/workflows/validate-description.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/validate-description.yml b/.github/workflows/validate-description.yml index 91eee3a..e2b7cb5 100644 --- a/.github/workflows/validate-description.yml +++ b/.github/workflows/validate-description.yml @@ -31,8 +31,6 @@ jobs: echo "$pr_body" > pr_body.txt - name: Check PR description for work item link - env: - PR_BODY: ${{ github.event.pull_request.body }} run: | echo "Checking PR description for work item link" python .global-checks-tooling/checks/check_pr_description.py "$(cat pr_body.txt)"