From d99abecf1cc0970c8b118e173494c8986c33e338 Mon Sep 17 00:00:00 2001
From: Chongyi Zheng <git@zcy.dev>
Date: Wed, 7 Feb 2024 23:52:35 +0800
Subject: [PATCH] Add macos-14 to github hosted runners (#392)

* Add macos-14 to github hosted runners

* Fix tests
---
 rule_runner_label.go       | 13 +++++++++++++
 testdata/format/test.json  |  2 +-
 testdata/format/test.jsonl |  2 +-
 testdata/format/test.md    |  2 +-
 testdata/format/test.sarif |  2 +-
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/rule_runner_label.go b/rule_runner_label.go
index 21936499f..4167f0dd6 100644
--- a/rule_runner_label.go
+++ b/rule_runner_label.go
@@ -18,6 +18,9 @@ const (
 	compatMacOS130
 	compatMacOS130L
 	compatMacOS130XL
+	compatMacOS140
+	compatMacOS140L
+	compatMacOS140XL
 	compatWindows2016
 	compatWindows2019
 	compatWindows2022
@@ -36,6 +39,11 @@ var allGitHubHostedRunnerLabels = []string{
 	"macos-latest-xl",
 	"macos-latest-xlarge",
 	"macos-latest-large",
+	"macos-14-xl",
+	"macos-14-xlarge",
+	"macos-14-large",
+	"macos-14",
+	"macos-14.0",
 	"macos-13-xl",
 	"macos-13-xlarge",
 	"macos-13-large",
@@ -70,6 +78,11 @@ var defaultRunnerOSCompats = map[string]runnerOSCompat{
 	"ubuntu-latest":       compatUbuntu2204,
 	"ubuntu-22.04":        compatUbuntu2204,
 	"ubuntu-20.04":        compatUbuntu2004,
+	"macos-14-xl":         compatMacOS140XL,
+	"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,
diff --git a/testdata/format/test.json b/testdata/format/test.json
index 8cd228ba6..7aca80956 100644
--- a/testdata/format/test.json
+++ b/testdata/format/test.json
@@ -1 +1 @@
-[{"message":"unexpected key \"branch\" for \"push\" section. expected one of \"branches\", \"branches-ignore\", \"paths\", \"paths-ignore\", \"tags\", \"tags-ignore\", \"types\", \"workflows\"","filepath":"testdata/format/test.yaml","line":3,"column":5,"kind":"syntax-check","snippet":"    branch: main\n    ^~~~~~~","end_column":11},{"message":"label \"linux-latest\" is unknown. available labels are \"windows-latest\", \"windows-2022\", \"windows-2019\", \"windows-2016\", \"ubuntu-latest\", \"ubuntu-22.04\", \"ubuntu-20.04\", \"macos-latest\", \"macos-latest-xl\", \"macos-latest-xlarge\", \"macos-latest-large\", \"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\", \"macos-11\", \"macos-11.0\", \"macos-10.15\", \"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","filepath":"testdata/format/test.yaml","line":6,"column":14,"kind":"runner-label","snippet":"    runs-on: linux-latest\n             ^~~~~~~~~~~~","end_column":25}]
+[{"message":"unexpected key \"branch\" for \"push\" section. expected one of \"branches\", \"branches-ignore\", \"paths\", \"paths-ignore\", \"tags\", \"tags-ignore\", \"types\", \"workflows\"","filepath":"testdata/format/test.yaml","line":3,"column":5,"kind":"syntax-check","snippet":"    branch: main\n    ^~~~~~~","end_column":11},{"message":"label \"linux-latest\" is unknown. available labels are \"windows-latest\", \"windows-2022\", \"windows-2019\", \"windows-2016\", \"ubuntu-latest\", \"ubuntu-22.04\", \"ubuntu-20.04\", \"macos-latest\", \"macos-latest-xl\", \"macos-latest-xlarge\", \"macos-latest-large\", \"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\", \"macos-11\", \"macos-11.0\", \"macos-10.15\", \"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","filepath":"testdata/format/test.yaml","line":6,"column":14,"kind":"runner-label","snippet":"    runs-on: linux-latest\n             ^~~~~~~~~~~~","end_column":25}]
diff --git a/testdata/format/test.jsonl b/testdata/format/test.jsonl
index 263e9a96f..22623529d 100644
--- a/testdata/format/test.jsonl
+++ b/testdata/format/test.jsonl
@@ -1,2 +1,2 @@
 {"message":"unexpected key \"branch\" for \"push\" section. expected one of \"branches\", \"branches-ignore\", \"paths\", \"paths-ignore\", \"tags\", \"tags-ignore\", \"types\", \"workflows\"","filepath":"testdata/format/test.yaml","line":3,"column":5,"kind":"syntax-check","snippet":"    branch: main\n    ^~~~~~~","end_column":11}
-{"message":"label \"linux-latest\" is unknown. available labels are \"windows-latest\", \"windows-2022\", \"windows-2019\", \"windows-2016\", \"ubuntu-latest\", \"ubuntu-22.04\", \"ubuntu-20.04\", \"macos-latest\", \"macos-latest-xl\", \"macos-latest-xlarge\", \"macos-latest-large\", \"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\", \"macos-11\", \"macos-11.0\", \"macos-10.15\", \"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","filepath":"testdata/format/test.yaml","line":6,"column":14,"kind":"runner-label","snippet":"    runs-on: linux-latest\n             ^~~~~~~~~~~~","end_column":25}
+{"message":"label \"linux-latest\" is unknown. available labels are \"windows-latest\", \"windows-2022\", \"windows-2019\", \"windows-2016\", \"ubuntu-latest\", \"ubuntu-22.04\", \"ubuntu-20.04\", \"macos-latest\", \"macos-latest-xl\", \"macos-latest-xlarge\", \"macos-latest-large\", \"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\", \"macos-11\", \"macos-11.0\", \"macos-10.15\", \"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","filepath":"testdata/format/test.yaml","line":6,"column":14,"kind":"runner-label","snippet":"    runs-on: linux-latest\n             ^~~~~~~~~~~~","end_column":25}
diff --git a/testdata/format/test.md b/testdata/format/test.md
index e1540020a..dc46c334f 100644
--- a/testdata/format/test.md
+++ b/testdata/format/test.md
@@ -9,7 +9,7 @@ unexpected key "branch" for "push" section. expected one of "branches", "branche
 
 ### Error at line 6, col 14 of `testdata/format/test.yaml`
 
-label "linux-latest" is unknown. available labels are "windows-latest", "windows-2022", "windows-2019", "windows-2016", "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "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", "macos-11", "macos-11.0", "macos-10.15", "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
+label "linux-latest" is unknown. available labels are "windows-latest", "windows-2022", "windows-2019", "windows-2016", "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "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", "macos-11", "macos-11.0", "macos-10.15", "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
 
 ```
     runs-on: linux-latest
diff --git a/testdata/format/test.sarif b/testdata/format/test.sarif
index cf105a87d..3c8547ae8 100644
--- a/testdata/format/test.sarif
+++ b/testdata/format/test.sarif
@@ -280,7 +280,7 @@
         {
           "ruleId": "runner-label",
           "message": {
-            "text": "label \"linux-latest\" is unknown. available labels are \"windows-latest\", \"windows-2022\", \"windows-2019\", \"windows-2016\", \"ubuntu-latest\", \"ubuntu-22.04\", \"ubuntu-20.04\", \"macos-latest\", \"macos-latest-xl\", \"macos-latest-xlarge\", \"macos-latest-large\", \"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\", \"macos-11\", \"macos-11.0\", \"macos-10.15\", \"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"
+            "text": "label \"linux-latest\" is unknown. available labels are \"windows-latest\", \"windows-2022\", \"windows-2019\", \"windows-2016\", \"ubuntu-latest\", \"ubuntu-22.04\", \"ubuntu-20.04\", \"macos-latest\", \"macos-latest-xl\", \"macos-latest-xlarge\", \"macos-latest-large\", \"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\", \"macos-11\", \"macos-11.0\", \"macos-10.15\", \"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"
           },
           "locations": [
             {