Skip to content

Commit 52fca62

Browse files
committed
Use buildAllGitHubHostedRunnerLabels() to build allGitHubHostedRunnerLabels
1 parent 0c5f33d commit 52fca62

File tree

1 file changed

+5
-34
lines changed

1 file changed

+5
-34
lines changed

rule_runner_label.go

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package actionlint
22

33
import (
44
"path"
5+
"slices"
56
"sort"
67
"strings"
78
)
@@ -32,45 +33,15 @@ const (
3233
func buildAllGitHubHostedRunnerLabels() []string {
3334
l := make([]string, 0, len(defaultRunnerOSCompats))
3435
for k := range defaultRunnerOSCompats {
35-
l = append(l, k)
36+
if !slices.Contains(selfHostedRunnerPresetOSLabels, k) {
37+
l = append(l, k)
38+
}
3639
}
3740
sort.Strings(l)
3841
return l
3942
}
4043

41-
// https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
42-
var allGitHubHostedRunnerLabels = []string{
43-
"windows-latest",
44-
"windows-latest-8-cores",
45-
"windows-2022",
46-
"windows-2019",
47-
"ubuntu-latest",
48-
"ubuntu-latest-4-cores",
49-
"ubuntu-latest-8-cores",
50-
"ubuntu-latest-16-cores",
51-
"ubuntu-24.04",
52-
"ubuntu-22.04",
53-
"ubuntu-20.04",
54-
"macos-latest",
55-
"macos-latest-xl",
56-
"macos-latest-xlarge",
57-
"macos-latest-large",
58-
"macos-15-xlarge",
59-
"macos-15-large",
60-
"macos-15",
61-
"macos-14-xl",
62-
"macos-14-xlarge",
63-
"macos-14-large",
64-
"macos-14",
65-
"macos-13-xl",
66-
"macos-13-xlarge",
67-
"macos-13-large",
68-
"macos-13",
69-
"macos-12-xl",
70-
"macos-12-xlarge",
71-
"macos-12-large",
72-
"macos-12",
73-
}
44+
var allGitHubHostedRunnerLabels = buildAllGitHubHostedRunnerLabels()
7445

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

0 commit comments

Comments
 (0)