Skip to content

Incorrect message when checking for extension upgrades #8535

Description

@ngoue

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

Activity

  1. added
    bugSomething isn't working
    on Jan 6, 2024
  2. ngoue commented on Jan 7, 2024

    @ngoue
    Author

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

  3. added
    priority-3Affects a small number of users or is largely cosmetic
    gh-extensionrelating to the gh extension command
    and removed on Jan 8, 2024
  4. samcoe commented on Jan 8, 2024

    @samcoe
    Contributor

    @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.

  5. leevic31 commented on Jan 15, 2024

    @leevic31
    Contributor

    Can I work on this one?

  6. yermulnik commented on Jan 21, 2024

    @yermulnik

    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.

  7. williammartin commented on Feb 14, 2024

    @williammartin
    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?

  8. yermulnik commented on Feb 14, 2024

    @yermulnik

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-extensionrelating to the gh extension commandhelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions