From 2601556b1992a4d2dff3b04b325a4a3fd1337412 Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 17 Dec 2024 12:13:15 +0900 Subject: [PATCH] fix types of some `github` context properties --- docs/checks.md | 2 +- expr_sema.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/checks.md b/docs/checks.md index 4165294fd..58ede6448 100644 --- a/docs/checks.md +++ b/docs/checks.md @@ -404,7 +404,7 @@ test.yaml:7:24: undefined variable "unknown_context". available variables are "e | 7 | - run: echo '${{ unknown_context }}' | ^~~~~~~~~~~~~~~ -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] +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: number; 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: bool; 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] | 9 | - run: echo '${{ github.events }}' | ^~~~~~~~~~~~~ diff --git a/expr_sema.go b/expr_sema.go index 51dcea8ca..cf2010702 100644 --- a/expr_sema.go +++ b/expr_sema.go @@ -211,7 +211,7 @@ var BuiltinGlobalVariableTypes = map[string]ExprType{ "actor": StringType{}, "actor_id": StringType{}, "api_url": StringType{}, - "artifact_cache_size_limit": StringType{}, // Note: Undocumented + "artifact_cache_size_limit": NumberType{}, // Note: Undocumented "base_ref": StringType{}, "env": StringType{}, "event": NewEmptyObjectType(), // Note: Stricter type check for this payload would be possible @@ -224,7 +224,7 @@ var BuiltinGlobalVariableTypes = map[string]ExprType{ "path": StringType{}, "ref": StringType{}, "ref_name": StringType{}, - "ref_protected": StringType{}, + "ref_protected": BoolType{}, "ref_type": StringType{}, "repository": StringType{}, "repository_id": StringType{},