Skip to content

Commit

Permalink
Use buildAllGitHubHostedRunnerLabels() to build allGitHubHostedRunner…
Browse files Browse the repository at this point in the history
…Labels
  • Loading branch information
muzimuzhi committed Oct 16, 2024
1 parent 0c5f33d commit 52fca62
Showing 1 changed file with 5 additions and 34 deletions.
39 changes: 5 additions & 34 deletions rule_runner_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package actionlint

import (
"path"
"slices"
"sort"
"strings"
)
Expand Down Expand Up @@ -32,45 +33,15 @@ const (
func buildAllGitHubHostedRunnerLabels() []string {
l := make([]string, 0, len(defaultRunnerOSCompats))
for k := range defaultRunnerOSCompats {
l = append(l, k)
if !slices.Contains(selfHostedRunnerPresetOSLabels, k) {
l = append(l, k)
}
}
sort.Strings(l)
return l
}

// https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
var allGitHubHostedRunnerLabels = []string{
"windows-latest",
"windows-latest-8-cores",
"windows-2022",
"windows-2019",
"ubuntu-latest",
"ubuntu-latest-4-cores",
"ubuntu-latest-8-cores",
"ubuntu-latest-16-cores",
"ubuntu-24.04",
"ubuntu-22.04",
"ubuntu-20.04",
"macos-latest",
"macos-latest-xl",
"macos-latest-xlarge",
"macos-latest-large",
"macos-15-xlarge",
"macos-15-large",
"macos-15",
"macos-14-xl",
"macos-14-xlarge",
"macos-14-large",
"macos-14",
"macos-13-xl",
"macos-13-xlarge",
"macos-13-large",
"macos-13",
"macos-12-xl",
"macos-12-xlarge",
"macos-12-large",
"macos-12",
}
var allGitHubHostedRunnerLabels = buildAllGitHubHostedRunnerLabels()

// https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow#using-default-labels-to-route-jobs
var selfHostedRunnerPresetOSLabels = []string{
Expand Down

0 comments on commit 52fca62

Please sign in to comment.