Skip to content

Commit bbcf9a3

Browse files
mtnbikencclaude
andcommitted
[hack] Show upstream push command after tag creation
Detects the remote pointing to openshift/windows-machine-config-operator and uses its name in the post-creation push instruction, falling back to the upstream SSH URL if no matching remote is configured. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d639e52 commit bbcf9a3

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

hack/create-release-tag.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,23 @@ def resolve_commit(ref: str) -> str:
152152
# Main
153153
# ---------------------------------------------------------------------------
154154

155+
def _find_upstream_remote() -> str:
156+
"""
157+
Return the name of the remote pointing to openshift/windows-machine-config-operator,
158+
or '' if none is configured.
159+
"""
160+
try:
161+
lines = git("remote", "-v").splitlines()
162+
except RuntimeError:
163+
return ""
164+
for line in lines:
165+
# Each line: "<name>\t<url> (fetch|push)"
166+
parts = line.split()
167+
if len(parts) >= 2 and "openshift/windows-machine-config-operator" in parts[1]:
168+
return parts[0]
169+
return ""
170+
171+
155172
def main():
156173
parser = argparse.ArgumentParser(
157174
description="Create an annotated WMCO release tag.",
@@ -256,9 +273,12 @@ def main():
256273
print(f"\nERROR: Failed to create tag: {exc}", file=sys.stderr)
257274
sys.exit(1)
258275

276+
upstream_remote = _find_upstream_remote()
277+
push_target = upstream_remote if upstream_remote else "git@github.com:openshift/windows-machine-config-operator.git"
278+
259279
print()
260-
print(f"Tag '{tag}' created. To push:")
261-
print(f" git push origin {tag}")
280+
print(f"Tag '{tag}' created. To push to the upstream repository:")
281+
print(f" git push {push_target} {tag}")
262282

263283

264284
if __name__ == "__main__":

0 commit comments

Comments
 (0)