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

Incorrect message when checking for extension upgrades #8535

Closed
ngoue opened this issue Jan 6, 2024 · 6 comments · Fixed by #9088
Closed

Incorrect message when checking for extension upgrades #8535

ngoue opened this issue Jan 6, 2024 · 6 comments · Fixed by #9088
Labels
bug Something isn't working gh-extension relating to the gh extension command help wanted Contributions welcome p3 Affects a small number of users or is largely cosmetic

Comments

@ngoue
Copy link

ngoue commented Jan 6, 2024

Describe the bug

When checking for an extension upgrade with the --dry-run flag, cli incorrectly reports that the extensions would have upgraded even though it reports it's already up-to-date in the same message.

I believe this change is related: 88cae9f

Steps to reproduce the behavior

  1. Install cli version 2.40.1 (2023-12-13)
  2. gh extension install HaywardMorihara/gh-tidy
  3. gh extension upgrade HaywardMorihara/gh-tidy --dry-run

Expected vs actual behavior

I would expect a message indicating the package is up-to-date instead of a message saying the extension would have upgraded.

Logs

$ gh extension upgrade HaywardMorihara/gh-tidy --dry-run
[tidy]: already up to date
✓ Would have upgraded extension
@ngoue ngoue added the bug Something isn't working label Jan 6, 2024
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Jan 6, 2024
@ngoue
Copy link
Author

ngoue commented Jan 7, 2024

After reviewing some code, I think it may just be better to not display any tty message after running the command with --dry-run.

@samcoe samcoe added p3 Affects a small number of users or is largely cosmetic gh-extension relating to the gh extension command help wanted Contributions welcome and removed needs-triage needs to be reviewed labels Jan 8, 2024
@samcoe
Copy link
Contributor

samcoe commented Jan 8, 2024

@ngoue Thanks for writing in. I was able to reproduce this bug, definitely a confusing message. Rather than change the output completely, I think we can just fix this message to instead state that there were no extensions that needed to be upgraded.

@leevic31
Copy link
Contributor

Can I work on this one?

@yermulnik
Copy link

This has been bugging me since ever and I needed to add this workaround to my crontab entry that monitors updates: gh extension upgrade --dry-run --all | egrep -v ": already up to date$"
Given this help message --dry-run Only display upgrades it would be really beneficial if --dry-run indeed showed only whether an extension needs upgrading. Or maybe adding --quiet to suppress already up to date messages would be enough.

Also trailing message in interactive mode (when the output is not piped) is confusing:

> gh extension upgrade --dry-run --all
[…]
[userfetch]: already up to date
[users]: already up to date
[webhook]: already up to date
✓ Would have upgraded extensions

> gh extension upgrade --dry-run --all | egrep -v ": already up to date$" -c
0

The ✓ Would have upgraded extensions line, that indicates there are some upgrades pending, is erroneous.

@williammartin
Copy link
Member

Given this help message --dry-run Only display upgrades it would be really beneficial if --dry-run indeed showed only whether an extension needs upgrading

This is a very confusing help message. What it means is "Only display upgrades (rather than actually applying the upgrade)".

The other part is the bug that this issue is capturing.

Just to double check, is the purpose of your cron job simply to determine whether and extensions could be upgraded?

@yermulnik
Copy link

yermulnik commented Feb 14, 2024

Just to double check, is the purpose of your cron job simply to determine whether and extensions could be upgraded?

Yep, exactly (assuming you mean any rather than and). It simply reports whether any of extensions need upgrading (by listing those that need upgrading) so that an operator can decide what to do with this information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gh-extension relating to the gh extension command help wanted Contributions welcome p3 Affects a small number of users or is largely cosmetic
Projects
None yet
6 participants