Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: do not close tracking issues #3106

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/scripts/generate_pr_commit_message
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"

Expand Down