Skip to content

Commit

Permalink
remove runner labels which are no longer available (fix #452)
Browse files Browse the repository at this point in the history
- `macos-12.0`
- `macos-13.0`
- `macos-14.0`
  • Loading branch information
rhysd committed Oct 16, 2024
1 parent 1ba25a7 commit 8d3e133
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test.yaml:5:11: character '\' is invalid for branch and tag names. only special
|
5 | - 'v\d+'
| ^~~~
test.yaml:10:28: label "linux-latest" is unknown. available labels are "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-14.0", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-13.0", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "macos-12.0", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file [runner-label]
test.yaml:10:28: label "linux-latest" is unknown. available labels are "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", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file [runner-label]
|
10 | os: [macos-latest, linux-latest]
| ^~~~~~~~~~~~~
Expand Down
16 changes: 10 additions & 6 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"
"sort"
"strings"
)

Expand All @@ -28,6 +29,15 @@ const (
compatWindows2022
)

func buildAllGitHubHostedRunnerLabels() []string {
l := make([]string, 0, len(defaultRunnerOSCompats))
for k := range defaultRunnerOSCompats {
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",
Expand All @@ -52,17 +62,14 @@ var allGitHubHostedRunnerLabels = []string{
"macos-14-xlarge",
"macos-14-large",
"macos-14",
"macos-14.0",
"macos-13-xl",
"macos-13-xlarge",
"macos-13-large",
"macos-13",
"macos-13.0",
"macos-12-xl",
"macos-12-xlarge",
"macos-12-large",
"macos-12",
"macos-12.0",
}

// https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow#using-default-labels-to-route-jobs
Expand Down Expand Up @@ -99,17 +106,14 @@ var defaultRunnerOSCompats = map[string]runnerOSCompat{
"macos-14-xlarge": compatMacOS140XL,
"macos-14-large": compatMacOS140L,
"macos-14": compatMacOS140,
"macos-14.0": compatMacOS140,
"macos-13-xl": compatMacOS130XL,
"macos-13-xlarge": compatMacOS130XL,
"macos-13-large": compatMacOS130L,
"macos-13": compatMacOS130,
"macos-13.0": compatMacOS130,
"macos-12-xl": compatMacOS120XL,
"macos-12-xlarge": compatMacOS120XL,
"macos-12-large": compatMacOS120L,
"macos-12": compatMacOS120,
"macos-12.0": compatMacOS120,
"windows-latest": compatWindows2022,
"windows-latest-8-cores": compatWindows2022,
"windows-2022": compatWindows2022,
Expand Down
4 changes: 2 additions & 2 deletions rule_runner_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestRuleRunnerLabelCheckLabels(t *testing.T) {
},
{
what: "simple GH-hosted macOS runner label",
labels: []string{"macos-14.0"},
labels: []string{"macos-14"},
},
{
what: "simple GH-hosted runner label in upper case",
Expand All @@ -40,7 +40,7 @@ func TestRuleRunnerLabelCheckLabels(t *testing.T) {
},
{
what: "self-hosted all macOS runner labels",
labels: []string{"self-hosted", "macOS", "macOS-latest", "macOS-14.0", "macOS-14"},
labels: []string{"self-hosted", "macOS", "macOS-latest", "macOS-14"},
},
{
what: "self-hosted Linux runner in upper case",
Expand Down

0 comments on commit 8d3e133

Please sign in to comment.