Skip to content

GithubReleases: only check tag_name#21645

Merged
MikeMcQuaid merged 1 commit intomainfrom
livecheck/github_releases-only-check-tag_name
Mar 1, 2026
Merged

GithubReleases: only check tag_name#21645
MikeMcQuaid merged 1 commit intomainfrom
livecheck/github_releases-only-check-tag_name

Conversation

@samford
Copy link
Member

@samford samford commented Mar 1, 2026

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

The GithubReleases livecheck strategy was originally set up to check the tag_name value and fall back to the release name. At the time, I advocated for only checking tag_name, as matching the version from the release name is almost never needed and could be handled in a strategy block. Notably, only checking tag_name makes it easier to switch between the Git and GithubLatest strategies (i.e., the same regex can be used for both).

This modifies GithubReleases to only check the tag_name value by default, as this behavior makes it a little easier for us to implement batch GithubLatest data fetching in the future (i.e., using the GitHub GraphQL API to fetch the latest release tag_name for 100 repositories per request). I've done comparative checks across all GithubLatest and GithubReleases livecheck blocks in homebrew-core and homebrew-cask to confirm that the results remain the same after this change. If we need to match against the release name going forward, we can check the value in a strategy block, as we're already doing in ~5 cases (out of ~1350 checks using GithubLatest or GithubReleases).

The `GithubReleases` livecheck strategy was originally set up to check
the `tag_name` value and fall back to the release `name`. At the time,
I advocated for only checking `tag_name`, as matching the version from
the release name is almost never needed and could be handled in a
`strategy` block. Notably, only checking `tag_name` makes it easier to
switch between the `Git` and `GithubLatest` strategies (i.e., the same
regex can be used for both).

This modifies `GithubReleases` to only check the `tag_name` value by
default, as this behavior makes it a little easier for us to implement
batch `GithubLatest` data fetching in the future (i.e., using the
GitHub GraphQL API to fetch the latest release `tag_name` for 100
repositories per request). I've done comparative checks across all
`GithubLatest` and `GithubReleases` `livecheck` blocks in
homebrew-core and homebrew-cask to confirm that the results remain the
same after this change. If we need to match against the release `name`
going forward, we can check the value in a `strategy` block, as we're
already doing in ~5 cases (out of ~1350 checks using `GithubLatest` or
`GithubReleases`).
Copilot AI review requested due to automatic review settings March 1, 2026 03:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the GithubReleases livecheck strategy to only match versions from GitHub release tag_name, removing the previous fallback to the release name to better align with other GitHub-based strategies and future batching plans.

Changes:

  • Remove name-based fallback version matching in GithubReleases (match only tag_name).
  • Update GithubReleases strategy specs/fixtures and expectations to reflect the new matching behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/livecheck/strategy/github_releases.rb Simplifies matching logic to extract versions only from release["tag_name"].
Library/Homebrew/test/livecheck/strategy/github_releases_spec.rb Updates fixture data and expected matches to align with tag-only matching.
Comments suppressed due to low confidence (1)

Library/Homebrew/test/livecheck/strategy/github_releases_spec.rb:60

  • The updated fixture no longer includes a release where tag_name doesn’t match the regex but name contains a version (the behavior being removed in this PR). Without such a case, the spec won’t fail if fallback-to-name matching is accidentally reintroduced later. Consider adding a release object with a non-matching tag_name but a version-like name, and asserting that version is not returned in matches.
        {
          "tag_name": "1.2.2",
          "name": "No version title",
          "draft": false,
          "prerelease": false
        },
        {
          "tag_name": "no-version-tag",
          "name": "No version title",
          "draft": false,
          "prerelease": false
        },

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Mar 1, 2026
Merged via the queue into main with commit b48e346 Mar 1, 2026
42 checks passed
@MikeMcQuaid MikeMcQuaid deleted the livecheck/github_releases-only-check-tag_name branch March 1, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants