-
Notifications
You must be signed in to change notification settings - Fork 48
feat: prompt user to publish public announcement in discord during metta publish #4527
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
base: yatharth/cogames-smoketest-from-child-repo
Are you sure you want to change the base?
Conversation
| if not typer.confirm("Would you like to post a public announcement about this release?", default=False): | ||
| info("Skipping public announcement.") | ||
| return | ||
|
|
||
| # Generate default template message | ||
| _pypi_url = f"https://pypi.org/project/{package.value}/" | ||
| template = textwrap.dedent( | ||
| f"""\ | ||
| 📦 **{package.value} v{version}** [released]({_pypi_url})! | ||
| - Added support for [blah] | ||
| - Bug fix for [blah] | ||
| """ | ||
| ) | ||
|
|
||
| # Open editor for user to compose message | ||
| info("Opening editor to compose public announcement...") | ||
| edited_message = typer.edit(template) | ||
|
|
||
| # Bail if message is empty. | ||
| if edited_message is None or len(edited_message.strip()) == 0: | ||
| info("No message composed. Skipping public announcement.") | ||
| return | ||
|
|
||
| # In dry-run mode, show what would be posted. | ||
| if dry_run: | ||
| info("Would post following message to public Discord:") | ||
| print(edited_message) | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dry-run check occurs after user prompts, causing unnecessary user interaction in dry-run mode. When dry_run=True, users are still prompted with typer.confirm() (line 281) and typer.edit() (line 298) before the dry-run check at line 306. This means dry-run mode requires full user interaction despite not posting anything.
In typical dry-run workflows, no user interaction should be required. The function should check dry_run at the beginning and skip all interactive prompts:
if dry_run:
info("Would prompt for public Discord announcement (skipped in dry-run mode)")
return
# Continue with interactive prompts...
if not typer.confirm(...):
...| if not typer.confirm("Would you like to post a public announcement about this release?", default=False): | |
| info("Skipping public announcement.") | |
| return | |
| # Generate default template message | |
| _pypi_url = f"https://pypi.org/project/{package.value}/" | |
| template = textwrap.dedent( | |
| f"""\ | |
| 📦 **{package.value} v{version}** [released]({_pypi_url})! | |
| - Added support for [blah] | |
| - Bug fix for [blah] | |
| """ | |
| ) | |
| # Open editor for user to compose message | |
| info("Opening editor to compose public announcement...") | |
| edited_message = typer.edit(template) | |
| # Bail if message is empty. | |
| if edited_message is None or len(edited_message.strip()) == 0: | |
| info("No message composed. Skipping public announcement.") | |
| return | |
| # In dry-run mode, show what would be posted. | |
| if dry_run: | |
| info("Would post following message to public Discord:") | |
| print(edited_message) | |
| return | |
| if dry_run: | |
| info("Would prompt for public Discord announcement (skipped in dry-run mode)") | |
| return | |
| if not typer.confirm("Would you like to post a public announcement about this release?", default=False): | |
| info("Skipping public announcement.") | |
| return | |
| # Generate default template message | |
| _pypi_url = f"https://pypi.org/project/{package.value}/" | |
| template = textwrap.dedent( | |
| f"""\ | |
| 📦 **{package.value} v{version}** [released]({_pypi_url})! | |
| - Added support for [blah] | |
| - Bug fix for [blah] | |
| """ | |
| ) | |
| # Open editor for user to compose message | |
| info("Opening editor to compose public announcement...") | |
| edited_message = typer.edit(template) | |
| # Bail if message is empty. | |
| if edited_message is None or len(edited_message.strip()) == 0: | |
| info("No message composed. Skipping public announcement.") | |
| return | |
| # In dry-run mode, show what would be posted. | |
| info("Would post following message to public Discord:") | |
| print(edited_message) | |
| return |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.

No description provided.