From 63a651ca9912b09b2f3fd98c463b26101b31548c Mon Sep 17 00:00:00 2001 From: Christine Kim Date: Mon, 13 Jan 2025 16:31:19 -0500 Subject: [PATCH 1/2] Update checking --- .github/pr_label_checker.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/pr_label_checker.py b/.github/pr_label_checker.py index d2a9aca189..a4eabb0b55 100644 --- a/.github/pr_label_checker.py +++ b/.github/pr_label_checker.py @@ -64,6 +64,7 @@ def search_for_linked_issues(pull_body: str) -> list: # Split the PR body by heading pull_body_list = pull_body.split('##') regex_pattern = rf'{ISSUES_URL}(\d)|(#[^\D]\d*)' + issue_numbers = [] for section in pull_body_list: # Find section with heading 'Related Issue' if section != None and 'Related Issue' in section: @@ -75,10 +76,10 @@ def search_for_linked_issues(pull_body: str) -> list: filtered_list = list(filter(None, flattened_list)) # Remove '#' from items issue_numbers = list(map(lambda item: item.replace('#', ''), filtered_list)) - return issue_numbers - # No linked issues - print(False) - sys.exit(0) + return issue_numbers + # No linked issues, return issue_numbers + # print(False) + # sys.exit(0) def get_linked_issues(issue_numbers: list) -> list: @@ -113,10 +114,10 @@ def get_issue_labels(response_list: list) -> list: if label_name not in combined_issue_labels: # Add label if it does not exist combined_issue_labels.append(label_name) - if not combined_issue_labels: - # No labels to return - print(False) - sys.exit(0) + # if not combined_issue_labels: + # # No labels to return + # print(False) + # sys.exit(0) return combined_issue_labels def update_pr_labels(pull_number: str, combined_issue_labels: list): @@ -163,9 +164,11 @@ def is_pr_bugfix(response: Response) -> bool: response = get_prs_associated_with_commit() pull_number, pull_body = get_pr_attributes(response) issue_numbers = search_for_linked_issues(pull_body) - response_list = get_linked_issues(issue_numbers) - combined_issue_labels = get_issue_labels(response_list) - update_pr_labels(pull_number, combined_issue_labels) + if len(issue_numbers): + response_list = get_linked_issues(issue_numbers) + combined_issue_labels = get_issue_labels(response_list) + if len(combined_issue_labels): + update_pr_labels(pull_number, combined_issue_labels) # Check if PR is a bugfix response = get_pr(pull_number) From bdabcfb2c4e8bd23864003ad3e81527c2fed066b Mon Sep 17 00:00:00 2001 From: Christine Kim Date: Mon, 13 Jan 2025 16:34:09 -0500 Subject: [PATCH 2/2] test 2 --- .github/workflows/autopr_bugfix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autopr_bugfix.yml b/.github/workflows/autopr_bugfix.yml index 86fd5fa0b9..f4277a3c7e 100644 --- a/.github/workflows/autopr_bugfix.yml +++ b/.github/workflows/autopr_bugfix.yml @@ -4,7 +4,7 @@ on: branches: - update_pr_workflow -# Test 1 +# Test 1 2 jobs: # Check if the PR is a bugfix