Skip to content

Commit d615f81

Browse files
committed
add more undocumented properties to type of github context
1 parent 69a9127 commit d615f81

File tree

2 files changed

+46
-43
lines changed

2 files changed

+46
-43
lines changed

docs/checks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ test.yaml:7:24: undefined variable "unknown_context". available variables are "e
404404
|
405405
7 | - run: echo '${{ unknown_context }}'
406406
| ^~~~~~~~~~~~~~~
407-
test.yaml:9:24: property "events" is not defined in object type {action: string; action_path: string; action_ref: string; action_repository: string; action_status: string; actor: string; actor_id: string; api_url: string; base_ref: string; env: string; event: object; event_name: string; event_path: string; graphql_url: string; head_ref: string; job: string; job_workflow_sha: string; path: string; ref: string; ref_name: string; ref_protected: string; ref_type: string; repository: string; repository_id: string; repository_owner: string; repository_owner_id: string; repository_visibility: string; repositoryurl: string; retention_days: number; run_attempt: string; run_id: string; run_number: string; secret_source: string; server_url: string; sha: string; token: string; triggering_actor: string; workflow: string; workflow_ref: string; workflow_sha: string; workspace: string} [expression]
407+
test.yaml:9:24: property "events" is not defined in object type {action: string; action_path: string; action_ref: string; action_repository: string; action_status: string; actor: string; actor_id: string; api_url: string; artifact_cache_size_limit: string; base_ref: string; env: string; event: object; event_name: string; event_path: string; graphql_url: string; head_ref: string; job: string; output: string; path: string; ref: string; ref_name: string; ref_protected: string; ref_type: string; repository: string; repository_id: string; repository_owner: string; repository_owner_id: string; repository_visibility: string; repositoryurl: string; retention_days: number; run_attempt: string; run_id: string; run_number: string; secret_source: string; server_url: string; sha: string; state: string; step_summary: string; token: string; triggering_actor: string; workflow: string; workflow_ref: string; workflow_sha: string; workspace: string} [expression]
408408
|
409409
9 | - run: echo '${{ github.events }}'
410410
| ^~~~~~~~~~~~~

expr_sema.go

+45-42
Original file line numberDiff line numberDiff line change
@@ -201,49 +201,52 @@ var BuiltinFuncSignatures = map[string][]*FuncSignature{
201201
// BuiltinGlobalVariableTypes defines types of all global variables. All context variables are
202202
// documented at https://docs.github.com/en/actions/learn-github-actions/contexts
203203
var BuiltinGlobalVariableTypes = map[string]ExprType{
204-
// https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
204+
// https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context
205205
"github": NewStrictObjectType(map[string]ExprType{
206-
"action": StringType{},
207-
"action_path": StringType{},
208-
"action_ref": StringType{},
209-
"action_repository": StringType{},
210-
"action_status": StringType{},
211-
"actor": StringType{},
212-
"actor_id": StringType{},
213-
"api_url": StringType{},
214-
"base_ref": StringType{},
215-
"env": StringType{},
216-
"event": NewEmptyObjectType(), // Note: Stricter type check for this payload would be possible
217-
"event_name": StringType{},
218-
"event_path": StringType{},
219-
"graphql_url": StringType{},
220-
"head_ref": StringType{},
221-
"job": StringType{},
222-
"job_workflow_sha": StringType{},
223-
"ref": StringType{},
224-
"ref_name": StringType{},
225-
"ref_protected": StringType{},
226-
"ref_type": StringType{},
227-
"path": StringType{},
228-
"repository": StringType{},
229-
"repository_id": StringType{},
230-
"repository_owner": StringType{},
231-
"repository_owner_id": StringType{},
232-
"repositoryurl": StringType{}, // repositoryUrl
233-
"repository_visibility": StringType{}, // Note: Undocumented
234-
"retention_days": NumberType{},
235-
"run_id": StringType{},
236-
"run_number": StringType{},
237-
"run_attempt": StringType{},
238-
"secret_source": StringType{},
239-
"server_url": StringType{},
240-
"sha": StringType{},
241-
"token": StringType{},
242-
"triggering_actor": StringType{},
243-
"workflow": StringType{},
244-
"workflow_ref": StringType{},
245-
"workflow_sha": StringType{},
246-
"workspace": StringType{},
206+
"action": StringType{},
207+
"action_path": StringType{}, // Note: Composite actions only
208+
"action_ref": StringType{},
209+
"action_repository": StringType{},
210+
"action_status": StringType{}, // Note: Composite actions only
211+
"actor": StringType{},
212+
"actor_id": StringType{},
213+
"api_url": StringType{},
214+
"artifact_cache_size_limit": StringType{}, // Note: Undocumented
215+
"base_ref": StringType{},
216+
"env": StringType{},
217+
"event": NewEmptyObjectType(), // Note: Stricter type check for this payload would be possible
218+
"event_name": StringType{},
219+
"event_path": StringType{},
220+
"graphql_url": StringType{},
221+
"head_ref": StringType{},
222+
"job": StringType{},
223+
"output": StringType{}, // Note: Undocumented
224+
"path": StringType{},
225+
"ref": StringType{},
226+
"ref_name": StringType{},
227+
"ref_protected": StringType{},
228+
"ref_type": StringType{},
229+
"repository": StringType{},
230+
"repository_id": StringType{},
231+
"repository_owner": StringType{},
232+
"repository_owner_id": StringType{},
233+
"repository_visibility": StringType{}, // Note: Undocumented
234+
"repositoryurl": StringType{}, // repositoryUrl
235+
"retention_days": NumberType{},
236+
"run_attempt": StringType{},
237+
"run_id": StringType{},
238+
"run_number": StringType{},
239+
"secret_source": StringType{},
240+
"server_url": StringType{},
241+
"sha": StringType{},
242+
"state": StringType{}, // Note: Undocumented
243+
"step_summary": StringType{}, // Note: Undocumented
244+
"token": StringType{},
245+
"triggering_actor": StringType{},
246+
"workflow": StringType{},
247+
"workflow_ref": StringType{},
248+
"workflow_sha": StringType{},
249+
"workspace": StringType{},
247250
}),
248251
// https://docs.github.com/en/actions/learn-github-actions/contexts#env-context
249252
"env": NewMapObjectType(StringType{}), // env.<env_name>

0 commit comments

Comments
 (0)