From 5c87a5339228fd9ca2a5ed5695ca57611cc870c6 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Wed, 16 Oct 2024 22:28:44 +0800 Subject: [PATCH 1/3] Revert "fix test failure due to goldmark v1.7.7 and staticlint warning" This reverts commit 9f88c8630a2c54aec675dbf783f2e54032568d6a. --- go.mod | 2 +- go.sum | 4 ++-- rule_runner_label.go | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fe434b32f..3e5e8eab4 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/mattn/go-colorable v0.1.13 github.com/mattn/go-runewidth v0.0.16 github.com/robfig/cron/v3 v3.0.1 - github.com/yuin/goldmark v1.7.4 + github.com/yuin/goldmark v1.7.7 golang.org/x/sync v0.8.0 golang.org/x/sys v0.26.0 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index b5c37d403..a22b77f3e 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= -github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= +github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/rule_runner_label.go b/rule_runner_label.go index b86b07991..bed1f8b7b 100644 --- a/rule_runner_label.go +++ b/rule_runner_label.go @@ -2,6 +2,7 @@ package actionlint import ( "path" + "sort" "strings" ) @@ -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", From 0c5f33db6b59907c8cdcf45bfb30914d452b1a25 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Wed, 16 Oct 2024 21:44:53 +0800 Subject: [PATCH 2/3] Fix test failure by updating formatting in Contexts availability testdata The GitHub Docs source has changed from ... to backticks 4 months ago, see https://github.com/github/docs/commit/a15d2618200b0567461d47bb3994d6378ca4c7b8 --- scripts/generate-availability/testdata/ok.md | 240 +++++++++---------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/scripts/generate-availability/testdata/ok.md b/scripts/generate-availability/testdata/ok.md index 03675a94b..e8468a198 100644 --- a/scripts/generate-availability/testdata/ok.md +++ b/scripts/generate-availability/testdata/ok.md @@ -74,69 +74,69 @@ The following table indicates where each context and special function can be use | Workflow key | Context | Special functions | | ---- | ------- | ----------------- | -| concurrency | github, inputs | None | -| env | github, secrets, inputs | None | -| jobs.<job_id>.concurrency | github, needs, strategy, matrix, inputs | None | -| jobs.<job_id>.container | github, needs, strategy, matrix, env, secrets, inputs | None | -| jobs.<job_id>.container.credentials | github, needs, strategy, matrix, env, secrets, inputs | None | -| jobs.<job_id>.container.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets, inputs | None | -| jobs.<job_id>.continue-on-error | github, needs, strategy, matrix, inputs | None | -| jobs.<job_id>.defaults.run | github, needs, strategy, matrix, env, inputs | None | -| jobs.<job_id>.env | github, needs, strategy, matrix, secrets, inputs | None | -| jobs.<job_id>.environment | github, needs, strategy, matrix, inputs | None | -| jobs.<job_id>.environment.url | github, needs, strategy, matrix, job, runner, env, steps, inputs | None | -| jobs.<job_id>.if | github, needs, inputs | always, cancelled, success, failure | -| jobs.<job_id>.name | github, needs, strategy, matrix, inputs | None | -| jobs.<job_id>.outputs.<output_id> | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | None | -| jobs.<job_id>.runs-on | github, needs, strategy, matrix, inputs | None | -| jobs.<job_id>.secrets.<secrets_id> | github, needs,{% ifversion actions-reusable-workflow-matrix %} strategy, matrix,{% endif %} secrets{% ifversion actions-unified-inputs %}, inputs{% endif %} | None | -| jobs.<job_id>.services | github, needs, strategy, matrix, inputs | None | -| jobs.<job_id>.services.<service_id>.credentials | github, needs, strategy, matrix, env, secrets, inputs | None | -| jobs.<job_id>.services.<service_id>.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets, inputs | None | -| jobs.<job_id>.steps.continue-on-error | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.env | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.if | github, needs, strategy, matrix, job, runner, env, steps, inputs | always, cancelled, success, failure, hashFiles | -| jobs.<job_id>.steps.name | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.run | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.timeout-minutes | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.with | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.working-directory | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.strategy | github, needs, inputs | None | -| jobs.<job_id>.timeout-minutes | github, needs, strategy, matrix, inputs | None | -| jobs.<job_id>.with.<with_id> | github, needs{% ifversion actions-reusable-workflow-matrix %}, strategy, matrix{% endif %}{% ifversion actions-unified-inputs %}, inputs{% endif %} | None | -| on.workflow_call.inputs.<inputs_id>.default | github{% ifversion actions-unified-inputs %}, inputs{% endif %} | None | -| on.workflow_call.outputs.<output_id>.value | github, jobs, inputs | None | +| `concurrency` | `github, inputs` | None | +| `env` | `github, secrets, inputs` | None | +| `jobs..concurrency` | `github, needs, strategy, matrix, inputs` | None | +| `jobs..container` | `github, needs, strategy, matrix, env, secrets, inputs` | None | +| `jobs..container.credentials` | `github, needs, strategy, matrix, env, secrets, inputs` | None | +| `jobs..container.env.` | `github, needs, strategy, matrix, job, runner, env, secrets, inputs` | None | +| `jobs..continue-on-error` | `github, needs, strategy, matrix, inputs` | None | +| `jobs..defaults.run` | `github, needs, strategy, matrix, env, inputs` | None | +| `jobs..env` | `github, needs, strategy, matrix, secrets, inputs` | None | +| `jobs..environment` | `github, needs, strategy, matrix, inputs` | None | +| `jobs..environment.url` | `github, needs, strategy, matrix, job, runner, env, steps, inputs` | None | +| `jobs..if` | `github, needs, inputs` | `always, cancelled, success, failure` | +| `jobs..name` | `github, needs, strategy, matrix, inputs` | None | +| `jobs..outputs.` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | None | +| `jobs..runs-on` | `github, needs, strategy, matrix, inputs` | None | +| `jobs..secrets.` | `github, needs,{% ifversion actions-reusable-workflow-matrix %} strategy, matrix,{% endif %} secrets{% ifversion actions-unified-inputs %}, inputs{% endif %}` | None | +| `jobs..services` | `github, needs, strategy, matrix, inputs` | None | +| `jobs..services..credentials` | `github, needs, strategy, matrix, env, secrets, inputs` | None | +| `jobs..services..env.` | `github, needs, strategy, matrix, job, runner, env, secrets, inputs` | None | +| `jobs..steps.continue-on-error` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.env` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.if` | `github, needs, strategy, matrix, job, runner, env, steps, inputs` | `always, cancelled, success, failure, hashFiles` | +| `jobs..steps.name` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.run` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.timeout-minutes` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.with` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.working-directory` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..strategy` | `github, needs, inputs` | None | +| `jobs..timeout-minutes` | `github, needs, strategy, matrix, inputs` | None | +| `jobs..with.` | `github, needs{% ifversion actions-reusable-workflow-matrix %}, strategy, matrix{% endif %}{% ifversion actions-unified-inputs %}, inputs{% endif %}` | None | +| `on.workflow_call.inputs..default` | `github{% ifversion actions-unified-inputs %}, inputs{% endif %}` | None | +| `on.workflow_call.outputs..value` | `github, jobs, inputs` | None | {% else %} | Path | Context | Special functions | | ---- | ------- | ----------------- | -| concurrency | github | None | -| env | github, secrets | None | -| jobs.<job_id>.concurrency | github, needs, strategy, matrix | None | -| jobs.<job_id>.container | github, needs, strategy, matrix | None | -| jobs.<job_id>.container.credentials | github, needs, strategy, matrix, env, secrets | None | -| jobs.<job_id>.container.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets | None | -| jobs.<job_id>.continue-on-error | github, needs, strategy, matrix | None | -| jobs.<job_id>.defaults.run | github, needs, strategy, matrix, env | None | -| jobs.<job_id>.env | github, needs, strategy, matrix, secrets | None | -| jobs.<job_id>.environment | github, needs, strategy, matrix | None | -| jobs.<job_id>.environment.url | github, needs, strategy, matrix, job, runner, env, steps | None | -| jobs.<job_id>.if | github, needs | always, cancelled, success, failure | -| jobs.<job_id>.name | github, needs, strategy, matrix | None | -| jobs.<job_id>.outputs.<output_id> | github, needs, strategy, matrix, job, runner, env, secrets, steps | None | -| jobs.<job_id>.runs-on | github, needs, strategy, matrix | None | -| jobs.<job_id>.services | github, needs, strategy, matrix | None | -| jobs.<job_id>.services.<service_id>.credentials | github, needs, strategy, matrix, env, secrets | None | -| jobs.<job_id>.services.<service_id>.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets | None | -| jobs.<job_id>.steps.continue-on-error | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.env | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.if | github, needs, strategy, matrix, job, runner, env, steps | always, cancelled, success, failure, hashFiles | -| jobs.<job_id>.steps.name | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.run | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.timeout-minutes | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.with | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.working-directory | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.strategy | github, needs | None | -| jobs.<job_id>.timeout-minutes | github, needs, strategy, matrix | None | +| `concurrency` | `github` | None | +| `env` | `github, secrets` | None | +| `jobs..concurrency` | `github, needs, strategy, matrix` | None | +| `jobs..container` | `github, needs, strategy, matrix` | None | +| `jobs..container.credentials` | `github, needs, strategy, matrix, env, secrets` | None | +| `jobs..container.env.` | `github, needs, strategy, matrix, job, runner, env, secrets` | None | +| `jobs..continue-on-error` | `github, needs, strategy, matrix` | None | +| `jobs..defaults.run` | `github, needs, strategy, matrix, env` | None | +| `jobs..env` | `github, needs, strategy, matrix, secrets` | None | +| `jobs..environment` | `github, needs, strategy, matrix` | None | +| `jobs..environment.url` | `github, needs, strategy, matrix, job, runner, env, steps` | None | +| `jobs..if` | `github, needs` | `always, cancelled, success, failure` | +| `jobs..name` | `github, needs, strategy, matrix` | None | +| `jobs..outputs.` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | None | +| `jobs..runs-on` | `github, needs, strategy, matrix` | None | +| `jobs..services` | `github, needs, strategy, matrix` | None | +| `jobs..services..credentials` | `github, needs, strategy, matrix, env, secrets` | None | +| `jobs..services..env.` | `github, needs, strategy, matrix, job, runner, env, secrets` | None | +| `jobs..steps.continue-on-error` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.env` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.if` | `github, needs, strategy, matrix, job, runner, env, steps` | `always, cancelled, success, failure, hashFiles` | +| `jobs..steps.name` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.run` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.timeout-minutes` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.with` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.working-directory` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..strategy` | `github, needs` | None | +| `jobs..timeout-minutes` | `github, needs, strategy, matrix` | None | {% endif %} ### Context availability 2 @@ -151,67 +151,67 @@ The following table indicates where each context and special function can be use | Workflow key | Context | Special functions | | ---- | ------- | ----------------- | -| concurrency | github, inputs | | -| env | github, secrets, inputs | | -| jobs.<job_id>.concurrency | github, needs, strategy, matrix, inputs | | -| jobs.<job_id>.container | github, needs, strategy, matrix, env, secrets, inputs | | -| jobs.<job_id>.container.credentials | github, needs, strategy, matrix, env, secrets, inputs | | -| jobs.<job_id>.container.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets, inputs | | -| jobs.<job_id>.continue-on-error | github, needs, strategy, matrix, inputs | | -| jobs.<job_id>.defaults.run | github, needs, strategy, matrix, env, inputs | | -| jobs.<job_id>.env | github, needs, strategy, matrix, secrets, inputs | | -| jobs.<job_id>.environment | github, needs, strategy, matrix, inputs | | -| jobs.<job_id>.environment.url | github, needs, strategy, matrix, job, runner, env, steps, inputs | | -| jobs.<job_id>.if | github, needs, inputs | always, cancelled, success, failure | -| jobs.<job_id>.name | github, needs, strategy, matrix, inputs | | -| jobs.<job_id>.outputs.<output_id> | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | | -| jobs.<job_id>.runs-on | github, needs, strategy, matrix, inputs | | -| jobs.<job_id>.secrets.<secrets_id> | github, needs,{% ifversion actions-reusable-workflow-matrix %} strategy, matrix,{% endif %} secrets{% ifversion actions-unified-inputs %}, inputs{% endif %} | | -| jobs.<job_id>.services | github, needs, strategy, matrix, inputs | | -| jobs.<job_id>.services.<service_id>.credentials | github, needs, strategy, matrix, env, secrets, inputs | | -| jobs.<job_id>.services.<service_id>.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets, inputs | | -| jobs.<job_id>.steps.continue-on-error | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.env | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.if | github, needs, strategy, matrix, job, runner, env, steps, inputs | always, cancelled, success, failure, hashFiles | -| jobs.<job_id>.steps.name | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.run | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.timeout-minutes | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.with | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.steps.working-directory | github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs | hashFiles | -| jobs.<job_id>.strategy | github, needs, inputs | | -| jobs.<job_id>.timeout-minutes | github, needs, strategy, matrix, inputs | | -| jobs.<job_id>.with.<with_id> | github, needs{% ifversion actions-reusable-workflow-matrix %}, strategy, matrix{% endif %}{% ifversion actions-unified-inputs %}, inputs{% endif %} | | -| on.workflow_call.inputs.<inputs_id>.default | github{% ifversion actions-unified-inputs %}, inputs{% endif %} | | -| on.workflow_call.outputs.<output_id>.value | github, jobs, inputs | | +| `concurrency` | `github, inputs` | | +| `env` | `github, secrets, inputs` | | +| `jobs..concurrency` | `github, needs, strategy, matrix, inputs` | | +| `jobs..container` | `github, needs, strategy, matrix, env, secrets, inputs` | | +| `jobs..container.credentials` | `github, needs, strategy, matrix, env, secrets, inputs` | | +| `jobs..container.env.` | `github, needs, strategy, matrix, job, runner, env, secrets, inputs` | | +| `jobs..continue-on-error` | `github, needs, strategy, matrix, inputs` | | +| `jobs..defaults.run` | `github, needs, strategy, matrix, env, inputs` | | +| `jobs..env` | `github, needs, strategy, matrix, secrets, inputs` | | +| `jobs..environment` | `github, needs, strategy, matrix, inputs` | | +| `jobs..environment.url` | `github, needs, strategy, matrix, job, runner, env, steps, inputs` | | +| `jobs..if` | `github, needs, inputs` | `always, cancelled, success, failure` | +| `jobs..name` | `github, needs, strategy, matrix, inputs` | | +| `jobs..outputs.` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | | +| `jobs..runs-on` | `github, needs, strategy, matrix, inputs` | | +| `jobs..secrets.` | `github, needs,{% ifversion actions-reusable-workflow-matrix %} strategy, matrix,{% endif %} secrets{% ifversion actions-unified-inputs %}, inputs{% endif %}` | | +| `jobs..services` | `github, needs, strategy, matrix, inputs` | | +| `jobs..services..credentials` | `github, needs, strategy, matrix, env, secrets, inputs` | | +| `jobs..services..env.` | `github, needs, strategy, matrix, job, runner, env, secrets, inputs` | | +| `jobs..steps.continue-on-error` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.env` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.if` | `github, needs, strategy, matrix, job, runner, env, steps, inputs` | `always, cancelled, success, failure, hashFiles` | +| `jobs..steps.name` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.run` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.timeout-minutes` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.with` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..steps.working-directory` | `github, needs, strategy, matrix, job, runner, env, secrets, steps, inputs` | `hashFiles` | +| `jobs..strategy` | `github, needs, inputs` | | +| `jobs..timeout-minutes` | `github, needs, strategy, matrix, inputs` | | +| `jobs..with.` | `github, needs{% ifversion actions-reusable-workflow-matrix %}, strategy, matrix{% endif %}{% ifversion actions-unified-inputs %}, inputs{% endif %}` | | +| `on.workflow_call.inputs..default` | `github{% ifversion actions-unified-inputs %}, inputs{% endif %}` | | +| `on.workflow_call.outputs..value` | `github, jobs, inputs` | | {% else %} | Path | Context | Special functions | | ---- | ------- | ----------------- | -| concurrency | github | | -| env | github, secrets | | -| jobs.<job_id>.concurrency | github, needs, strategy, matrix | | -| jobs.<job_id>.container | github, needs, strategy, matrix | | -| jobs.<job_id>.container.credentials | github, needs, strategy, matrix, env, secrets | | -| jobs.<job_id>.container.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets | | -| jobs.<job_id>.continue-on-error | github, needs, strategy, matrix | | -| jobs.<job_id>.defaults.run | github, needs, strategy, matrix, env | | -| jobs.<job_id>.env | github, needs, strategy, matrix, secrets | | -| jobs.<job_id>.environment | github, needs, strategy, matrix | | -| jobs.<job_id>.environment.url | github, needs, strategy, matrix, job, runner, env, steps | | -| jobs.<job_id>.if | github, needs | always, cancelled, success, failure | -| jobs.<job_id>.name | github, needs, strategy, matrix | | -| jobs.<job_id>.outputs.<output_id> | github, needs, strategy, matrix, job, runner, env, secrets, steps | | -| jobs.<job_id>.runs-on | github, needs, strategy, matrix | | -| jobs.<job_id>.services | github, needs, strategy, matrix | | -| jobs.<job_id>.services.<service_id>.credentials | github, needs, strategy, matrix, env, secrets | | -| jobs.<job_id>.services.<service_id>.env.<env_id> | github, needs, strategy, matrix, job, runner, env, secrets | | -| jobs.<job_id>.steps.continue-on-error | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.env | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.if | github, needs, strategy, matrix, job, runner, env, steps | always, cancelled, success, failure, hashFiles | -| jobs.<job_id>.steps.name | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.run | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.timeout-minutes | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.with | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.steps.working-directory | github, needs, strategy, matrix, job, runner, env, secrets, steps | hashFiles | -| jobs.<job_id>.strategy | github, needs | | -| jobs.<job_id>.timeout-minutes | github, needs, strategy, matrix | | +| `concurrency` | `github` | | +| `env` | `github, secrets` | | +| `jobs..concurrency` | `github, needs, strategy, matrix` | | +| `jobs..container` | `github, needs, strategy, matrix` | | +| `jobs..container.credentials` | `github, needs, strategy, matrix, env, secrets` | | +| `jobs..container.env.` | `github, needs, strategy, matrix, job, runner, env, secrets` | | +| `jobs..continue-on-error` | `github, needs, strategy, matrix` | | +| `jobs..defaults.run` | `github, needs, strategy, matrix, env` | | +| `jobs..env` | `github, needs, strategy, matrix, secrets` | | +| `jobs..environment` | `github, needs, strategy, matrix` | | +| `jobs..environment.url` | `github, needs, strategy, matrix, job, runner, env, steps` | | +| `jobs..if` | `github, needs` | `always, cancelled, success, failure` | +| `jobs..name` | `github, needs, strategy, matrix` | | +| `jobs..outputs.` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | | +| `jobs..runs-on` | `github, needs, strategy, matrix` | | +| `jobs..services` | `github, needs, strategy, matrix` | | +| `jobs..services..credentials` | `github, needs, strategy, matrix, env, secrets` | | +| `jobs..services..env.` | `github, needs, strategy, matrix, job, runner, env, secrets` | | +| `jobs..steps.continue-on-error` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.env` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.if` | `github, needs, strategy, matrix, job, runner, env, steps` | `always, cancelled, success, failure, hashFiles` | +| `jobs..steps.name` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.run` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.timeout-minutes` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.with` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..steps.working-directory` | `github, needs, strategy, matrix, job, runner, env, secrets, steps` | `hashFiles` | +| `jobs..strategy` | `github, needs` | | +| `jobs..timeout-minutes` | `github, needs, strategy, matrix` | | {% endif %} From 52fca628be83b6ec2dcd4bd632b77b882492e6ae Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Wed, 16 Oct 2024 21:52:18 +0800 Subject: [PATCH 3/3] Use buildAllGitHubHostedRunnerLabels() to build allGitHubHostedRunnerLabels --- rule_runner_label.go | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/rule_runner_label.go b/rule_runner_label.go index bed1f8b7b..48124e9cc 100644 --- a/rule_runner_label.go +++ b/rule_runner_label.go @@ -2,6 +2,7 @@ package actionlint import ( "path" + "slices" "sort" "strings" ) @@ -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{