diff --git a/.github/workflows/scripts/generate_pr_commit_message b/.github/workflows/scripts/generate_pr_commit_message index d8b06680ada..d9e756ec713 100755 --- a/.github/workflows/scripts/generate_pr_commit_message +++ b/.github/workflows/scripts/generate_pr_commit_message @@ -226,9 +226,19 @@ main() { # Create a regex pattern from the keywords: keywords_pattern=$(IFS='|'; echo "${closing_keywords[*]}") + tracking_issue_comment="" for issue in $issue_numbers; do + # Fetch issue details to check for tracking issue label + issue_details=$(github_api "GET" "/repos/$REPO_OWNER/$REPO_NAME/issues/$issue") + is_tracking=$(echo "$issue_details" | jq -r '.labels[].name' | grep -q "Tracking Issue" && echo "true" || echo "false") + if echo "$pr_body" | grep -Eiq "(${keywords_pattern})([[:space:]]+|:)[[:space:]]*#${issue}\b"; then closes_issues+="Closes: https://github.com/$REPO_OWNER/$REPO_NAME/issues/$issue\n" + + # Add comment if it's a tracking issue + if [ "$is_tracking" = "true" ]; then + tracking_issue_comment+="This is a tracking issue. Please Modify the OP, if required." + fi else ref_issues+="Ref: https://github.com/$REPO_OWNER/$REPO_NAME/issues/$issue\n" fi @@ -246,7 +256,6 @@ main() { if [ -n "$ref_issues" ]; then commit_body+="\n$ref_issues" fi - commit_body+="\n" if [ -n "$all_co_authors" ]; then commit_body+="\n$all_co_authors" fi @@ -260,6 +269,10 @@ main() { commit_body+="\n$signed_off_bys" fi + if [ -n "$tracking_issue_comment" ]; then + commit_body+="\n$tracking_issue_comment" + fi + # Combine subject and body: commit_message="$commit_subject\n\n$commit_body"