mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 19:50:24 +00:00
31 lines
1.1 KiB
PowerShell
31 lines
1.1 KiB
PowerShell
class BaseVersionsParser {
|
|
[Int32]$ApiRetryCount = 3
|
|
[Int32]$ApiRetryIntervalSeconds = 60
|
|
|
|
[SemVer[]] GetAvailableVersions() {
|
|
$allVersionsRaw = $this.ParseAllAvailableVersions()
|
|
$allVersions = $allVersionsRaw | ForEach-Object { $this.FormatVersion($_) }
|
|
$filteredVersions = $allVersions | Where-Object { $this.ShouldIncludeVersion($_) }
|
|
return $filteredVersions
|
|
}
|
|
|
|
[SemVer[]] GetUploadedVersions() {
|
|
throw "Method is not implemented in base class"
|
|
}
|
|
|
|
hidden [SemVer[]] ParseAllAvailableVersions() {
|
|
throw "Method is not implemented in base class"
|
|
}
|
|
|
|
hidden [SemVer] FormatVersion([string]$VersionSpec) {
|
|
throw "Method is not implemented in base class"
|
|
}
|
|
|
|
hidden [bool] ShouldIncludeVersion([SemVer]$Version) {
|
|
throw "Method is not implemented in base class"
|
|
}
|
|
|
|
hidden [string] BuildGitHubFileUrl($OrganizationName, $RepositoryName, $BranchName, $FilePath) {
|
|
return "https://raw.githubusercontent.com/${OrganizationName}/${RepositoryName}/${BranchName}/${FilePath}"
|
|
}
|
|
} |