Skip to content

Commit

Permalink
Disable golangci-lint automatic updates
Browse files Browse the repository at this point in the history
  • Loading branch information
glennsarti authored Apr 8, 2024
1 parent ee67ac4 commit 21abc98
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions automatic/golangci-lint/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,46 @@ function global:au_SearchReplace {

function global:au_GetLatest {
$streams = [ordered]@{}
$VersionRegEx = 'v(\d+\.\d+\.\d+)'

$Header = @{
"Accept" = "application/vnd.github.v3+json"
}
# Golangci-lint is updates are currently disable for the moment as the maintainers of that project are doing their own releases
# So instead of deleting this code, we'll just disable it

# We only care about the first 30 releases.
$Page = 1
$Url = "https://api.github.com/repos/$GitHubOrg/$GitHubRepo/releases?per_page=30&page=$Page"
# $VersionRegEx = 'v(\d+\.\d+\.\d+)'

$result = Invoke-RestMethod -Uri $Url -Method 'GET' -Headers $Header
# $Header = @{
# "Accept" = "application/vnd.github.v3+json"
# }

$result | ForEach-Object {
if ($matches.count -gt 0) { [void]$matches.clear }
if ($_.Name -match $VersionRegEx) {
Write-Output ([PSCustomObject]@{
Version = [System.Version]$matches[1]
Name = $_.Name
})
}
} |
Sort-Object -Descending -Property Version |
ForEach-Object {
$ver = $_.Version
$minorVer = $ver.ToString(2)
if (!$streams.Contains($minorVer)) {
$download64 = "https://github.com/$GitHubOrg/$GitHubRepo/releases/download/$($_.Name)/golangci-lint-$ver-windows-amd64.zip"
$download32 = "https://github.com/$GitHubOrg/$GitHubRepo/releases/download/$($_.Name)/golangci-lint-$ver-windows-386.zip"
$streams.$minorVer = @{ URL64 = $download64;
URL32 = $download32;
ZipFolder64 ="golangci-lint-$ver-windows-amd64"
ZipFolder32 ="golangci-lint-$ver-windows-386"
Version = $ver.ToString()
}
}
}
# # We only care about the first 30 releases.
# $Page = 1
# $Url = "https://api.github.com/repos/$GitHubOrg/$GitHubRepo/releases?per_page=30&page=$Page"

# $result = Invoke-RestMethod -Uri $Url -Method 'GET' -Headers $Header

# $result | ForEach-Object {
# if ($matches.count -gt 0) { [void]$matches.clear }
# if ($_.Name -match $VersionRegEx) {
# Write-Output ([PSCustomObject]@{
# Version = [System.Version]$matches[1]
# Name = $_.Name
# })
# }
# } |
# Sort-Object -Descending -Property Version |
# ForEach-Object {
# $ver = $_.Version
# $minorVer = $ver.ToString(2)
# if (!$streams.Contains($minorVer)) {
# $download64 = "https://github.com/$GitHubOrg/$GitHubRepo/releases/download/$($_.Name)/golangci-lint-$ver-windows-amd64.zip"
# $download32 = "https://github.com/$GitHubOrg/$GitHubRepo/releases/download/$($_.Name)/golangci-lint-$ver-windows-386.zip"
# $streams.$minorVer = @{ URL64 = $download64;
# URL32 = $download32;
# ZipFolder64 ="golangci-lint-$ver-windows-amd64"
# ZipFolder32 ="golangci-lint-$ver-windows-386"
# Version = $ver.ToString()
# }
# }
# }

@{ Streams = $streams }
}
Expand Down

0 comments on commit 21abc98

Please sign in to comment.