aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/jobs/outdated-servers/github_release_file.lua
blob: 66523a23156d5b1e35a9a57dfb4b8be8137b2444 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local github_client = require "nvim-lsp-installer.core.managers.github.client"

---@async
---@param receipt InstallReceipt
return function(receipt)
    local source = receipt.primary_source
    return github_client.fetch_latest_release(source.repo, { tag_name_pattern = source.tag_name_pattern }):map_catching(
        ---@param latest_release GitHubRelease
        function(latest_release)
            if source.release ~= latest_release.tag_name then
                return {
                    name = source.repo,
                    current_version = source.release,
                    latest_version = latest_release.tag_name,
                }
            end
            error "Primary package is not outdated."
        end
    )
end