-
Notifications
You must be signed in to change notification settings - Fork 163
/
availability.go
56 lines (52 loc) · 5.55 KB
/
availability.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Code generated by actionlint/scripts/generate-availability. DO NOT EDIT.
package actionlint
// WorkflowKeyAvailability returns contexts and special functions availability of the given workflow key.
// 1st return value indicates what contexts are available. Empty slice means any contexts are available.
// 2nd return value indicates what special functions are available. Empty slice means no special functions are available.
// The 'key' parameter should represents a workflow key like "jobs.<job_id>.concurrency".
//
// This function was generated from https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
// See the script for more details: https://github.com/rhysd/actionlint/blob/main/scripts/generate-availability/
func WorkflowKeyAvailability(key string) ([]string, []string) {
switch key {
case "jobs.<job_id>.outputs.<output_id>":
return []string{"env", "github", "inputs", "job", "matrix", "needs", "runner", "secrets", "steps", "strategy", "vars"}, []string{}
case "jobs.<job_id>.steps.continue-on-error", "jobs.<job_id>.steps.env", "jobs.<job_id>.steps.name", "jobs.<job_id>.steps.run", "jobs.<job_id>.steps.timeout-minutes", "jobs.<job_id>.steps.with", "jobs.<job_id>.steps.working-directory":
return []string{"env", "github", "inputs", "job", "matrix", "needs", "runner", "secrets", "steps", "strategy", "vars"}, []string{"hashfiles"}
case "jobs.<job_id>.container.env.<env_id>", "jobs.<job_id>.services.<service_id>.env.<env_id>":
return []string{"env", "github", "inputs", "job", "matrix", "needs", "runner", "secrets", "strategy", "vars"}, []string{}
case "jobs.<job_id>.environment.url":
return []string{"env", "github", "inputs", "job", "matrix", "needs", "runner", "steps", "strategy", "vars"}, []string{}
case "jobs.<job_id>.steps.if":
return []string{"env", "github", "inputs", "job", "matrix", "needs", "runner", "steps", "strategy", "vars"}, []string{"always", "cancelled", "failure", "hashfiles", "success"}
case "jobs.<job_id>.container.credentials", "jobs.<job_id>.services.<service_id>.credentials":
return []string{"env", "github", "inputs", "matrix", "needs", "secrets", "strategy", "vars"}, []string{}
case "jobs.<job_id>.defaults.run":
return []string{"env", "github", "inputs", "matrix", "needs", "strategy", "vars"}, []string{}
case "on.workflow_call.outputs.<output_id>.value":
return []string{"github", "inputs", "jobs", "vars"}, []string{}
case "jobs.<job_id>.env", "jobs.<job_id>.secrets.<secrets_id>":
return []string{"github", "inputs", "matrix", "needs", "secrets", "strategy", "vars"}, []string{}
case "jobs.<job_id>.concurrency", "jobs.<job_id>.container", "jobs.<job_id>.container.image", "jobs.<job_id>.continue-on-error", "jobs.<job_id>.environment", "jobs.<job_id>.name", "jobs.<job_id>.runs-on", "jobs.<job_id>.services", "jobs.<job_id>.timeout-minutes", "jobs.<job_id>.with.<with_id>":
return []string{"github", "inputs", "matrix", "needs", "strategy", "vars"}, []string{}
case "jobs.<job_id>.strategy":
return []string{"github", "inputs", "needs", "vars"}, []string{}
case "jobs.<job_id>.if":
return []string{"github", "inputs", "needs", "vars"}, []string{"always", "cancelled", "failure", "success"}
case "env":
return []string{"github", "inputs", "secrets", "vars"}, []string{}
case "concurrency", "on.workflow_call.inputs.<inputs_id>.default", "run-name":
return []string{"github", "inputs", "vars"}, []string{}
default:
return nil, nil
}
}
// SpecialFunctionNames is a map from special function name to available workflow keys.
// Some functions are only available at specific positions. This variable is useful when you want to
// know which functions are special and what workflow keys support them.
//
// This function was generated from https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
// See the script for more details: https://github.com/rhysd/actionlint/blob/main/scripts/generate-availability/
var SpecialFunctionNames = map[string][]string{"always": []string{"jobs.<job_id>.if", "jobs.<job_id>.steps.if"}, "cancelled": []string{"jobs.<job_id>.if", "jobs.<job_id>.steps.if"}, "failure": []string{"jobs.<job_id>.if", "jobs.<job_id>.steps.if"}, "hashfiles": []string{"jobs.<job_id>.steps.continue-on-error", "jobs.<job_id>.steps.env", "jobs.<job_id>.steps.if", "jobs.<job_id>.steps.name", "jobs.<job_id>.steps.run", "jobs.<job_id>.steps.timeout-minutes", "jobs.<job_id>.steps.with", "jobs.<job_id>.steps.working-directory"}, "success": []string{"jobs.<job_id>.if", "jobs.<job_id>.steps.if"}}
// For test
var allWorkflowKeys = []string{"concurrency", "env", "jobs.<job_id>.concurrency", "jobs.<job_id>.container", "jobs.<job_id>.container.credentials", "jobs.<job_id>.container.env.<env_id>", "jobs.<job_id>.container.image", "jobs.<job_id>.continue-on-error", "jobs.<job_id>.defaults.run", "jobs.<job_id>.env", "jobs.<job_id>.environment", "jobs.<job_id>.environment.url", "jobs.<job_id>.if", "jobs.<job_id>.name", "jobs.<job_id>.outputs.<output_id>", "jobs.<job_id>.runs-on", "jobs.<job_id>.secrets.<secrets_id>", "jobs.<job_id>.services", "jobs.<job_id>.services.<service_id>.credentials", "jobs.<job_id>.services.<service_id>.env.<env_id>", "jobs.<job_id>.steps.continue-on-error", "jobs.<job_id>.steps.env", "jobs.<job_id>.steps.if", "jobs.<job_id>.steps.name", "jobs.<job_id>.steps.run", "jobs.<job_id>.steps.timeout-minutes", "jobs.<job_id>.steps.with", "jobs.<job_id>.steps.working-directory", "jobs.<job_id>.strategy", "jobs.<job_id>.timeout-minutes", "jobs.<job_id>.with.<with_id>", "on.workflow_call.inputs.<inputs_id>.default", "on.workflow_call.outputs.<output_id>.value", "run-name"}