Skip to content

Commit 4c320c1

Browse files
dani-tweigyaronkaikov
authored andcommitted
Generalize promoted-to-master logic to any promoted-to-* label on any repo
## What changed - In manage_labeled_gh_event() (Step 7), replaced the hardcoded check triggering_label == 'promoted-to-master' and owner_repo == 'scylladb/staging' with triggering_label.startswith('promoted-to-'). ## Why (Requirements Summary) - The promoted-to-master + scylladb/staging logic was too restrictive. The same close-and-comment behavior should trigger for any label that starts with promoted-to- (e.g. promoted-to-master, promoted-to-branch-6.2, promoted-to-enterprise) on any repository, not just scylladb/staging. - This makes the Jira sync automation reusable across all repos that use promoted-to-* labels to signal branch promotion. - Re-applies the change from PR #139, which was overridden by a subsequent commit. Fixes: PM-209
1 parent aaea891 commit 4c320c1

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

scripts/jira_sync_logic.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def manage_labeled_gh_event(
4646
4. extract_jira_issue_details
4747
5. apply_jira_labels_to_pr
4848
6. if label is status/merge_candidate -> transition to Ready for Merge
49-
7. if label is promoted-to-master AND repo is scylladb/staging:
49+
7. if label starts with promoted-to-:
5050
a. add comment b. transition to Done
5151
"""
5252
print("=" * 60)
@@ -125,31 +125,31 @@ def manage_labeled_gh_event(
125125
else:
126126
print(f"SKIPPED: triggering_label is '{triggering_label}', not 'status/merge_candidate'")
127127

128-
# --- Step 7: promoted-to-master (scylladb/staging only) ---
128+
# --- Step 7: promoted-to-* label ---
129129
print("\n" + "=" * 60)
130-
print(" Step 7a / add_comment_to_jira (promoted-to-master)")
130+
print(" Step 7a / add_comment_to_jira (promoted-to-*)")
131131
print("=" * 60)
132-
if triggering_label == "promoted-to-master" and owner_repo == "scylladb/staging":
132+
if triggering_label.startswith("promoted-to-"):
133133
pr_url = f"https://github.com/{owner_repo}/pull/{pr_number}"
134134
add_comment_to_jira(
135135
jira_keys_json,
136-
"Closed via promoted-to-master label on PR ",
136+
f"Closed via {triggering_label} label on PR ",
137137
jira_auth,
138138
link_text=pr_title,
139139
link_url=pr_url,
140140
)
141141
else:
142-
print(f"SKIPPED: triggering_label is '{triggering_label}' and owner_repo is '{owner_repo}'"
143-
f" (requires 'promoted-to-master' on 'scylladb/staging')")
142+
print(f"SKIPPED: triggering_label is '{triggering_label}'"
143+
f" (requires label starting with 'promoted-to-')")
144144

145145
print("\n" + "=" * 60)
146146
print(" Step 7b / jira_status_transition -> Done")
147147
print("=" * 60)
148-
if triggering_label == "promoted-to-master" and owner_repo == "scylladb/staging":
148+
if triggering_label.startswith("promoted-to-"):
149149
jira_status_transition(csv_content, "Done", "141", jira_auth)
150150
else:
151-
print(f"SKIPPED: triggering_label is '{triggering_label}' and owner_repo is '{owner_repo}'"
152-
f" (requires 'promoted-to-master' on 'scylladb/staging')")
151+
print(f"SKIPPED: triggering_label is '{triggering_label}'"
152+
f" (requires label starting with 'promoted-to-')")
153153

154154
print("\n" + "=" * 60)
155155
print(" manage_labeled_gh_event completed successfully")
@@ -713,8 +713,8 @@ def debug_sync_context():
713713
if label == 'status/merge_candidate':
714714
print("Try to transition Jira issue to 'Ready For Merge'")
715715

716-
if label == 'promoted-to-master':
717-
print("Try to close Jira issue (promoted-to-master label added)")
716+
if label.startswith('promoted-to-'):
717+
print(f"Try to close Jira issue ({label} label added)")
718718

719719
print("~~~~~~~~~~~ GitHub Context ~~~~~~~~~~~")
720720
if github_context:

0 commit comments

Comments
 (0)