albr21/gha-type-guard

Action to check types at runtime using TypeScript's type system. Supports the following types: - string (with optional regex pattern) - boolean - integer - float - number (either integer or float) - array (with specified item type) - enum (with specified allowed values) - object (with specified property types) - any (accepts any value) - union (accepts any of the specified types)

View on GitHub

Trust Signals

Scorecard Score
not yet scored
Maintenance Recency
Activelast commit May 24, 2026
License
MIT

Pinned Snippet

workflow.ymlSHA-pinned
uses: albr21/gha-type-guard@40b1b60d6e8fc591a250bf0f66da2a8c5b6182cc # 1.0.0

tags can be moved; commit SHAs can't. why a SHA?

namedescriptionrequireddefault
payloadThe payload to check types for, as a JSON list string. It will be parsed and verified against the provided TypeScript types. Simple Format: [ {"value": <value1>, "type": "string"}, {"value": <value1>, "type": "string", "pattern": "^[a-zA-Z]+$"}, {"value": <value2>, "type": "boolean"}, {"value": <value3>, "type": "integer"}, {"value": <value4>, "type": "float"}, {"value": <value4>, "type": "number"}, {"value": <value8>, "type": "any"}, {"value": <value5>, "type": "array", "itemsType": "string"}, {"value": <value6>, "type": "enum", "enumValues": ["value1", "value2"]}, {"value": <value7>, "type": "object", "propertyTypes": {"name": "string", "age": "integer"}}, {"value": <value11>, "type": "union", "unionTypes": ["string", "integer"]} ] Schema Format: [ {"value": <value1>, "schema": {"type": "string"}}, {"value": <value2>, "schema": {"type": "boolean"}}, {"value": <value3>, "schema": {"type": "integer"}}, {"value": <value4>, "schema": {"type": "float"}}, {"value": <value4>, "schema": {"type": "number"}}, {"value": <value5>, "schema": {"type": "array", "items": {"type": "string"}}}, {"value": <value6>, "schema": {"type": "enum", "values": ["value1", "value2"]}}, {"value": <value7>, "schema": {"type": "object", "properties": {"name": {"type":"string"}, "age":{"type":"integer"}}, "required": ["name", "age"]}}, {"value": <value8>, "schema": {"type": "any"}}, {"value": <value11>, "schema": {"type": "union", "anyOf": [{"type": "string"}, {"type": "integer"}]}} ]yes
fail-fastIf true, the action will fail immediately on the first type validation error. If false, it will validate all items and report all errors at once.nofalse

no outputs