A lightweight and flexible set of validators for GitHub Actions. Ensure your inputs, secrets, and outputs meet specific criteria before proceeding with your workflow, preventing unexpected errors downstream.
- ✅ Regex Validation: Powerful pattern matching for complex string formats like emails, versions, or custom identifiers.
- 📋 Enum Validation: Restrict values to a specific set of allowed options, ideal for environment names, deployment targets, etc.
- 🛡️ Fail Fast: Stop workflows immediately when validation fails, saving time and resources.
Perfect for validating string formats like email addresses, phone numbers, or semantic versions.
name: Regex Validation Example
on:
workflow_dispatch:
inputs:
email:
description: Email to validate
required: true
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Validate Email
uses: actalog/expect@v1
with:
type: regex
value: ${{ github.event.inputs.email }}
pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'Useful for ensuring that a value belongs to a predefined list of valid options.
name: Enum Validation Example
on:
workflow_dispatch:
inputs:
environment:
description: Environment to deploy
required: true
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Validate Environment
uses: actalog/expect@v1
with:
type: enum
value: ${{ github.event.inputs.environment }}
options: 'staging,production,beta'| Input | Description | Required |
|---|---|---|
type |
The validator to use. Supported: regex, enum. |
Yes |
value |
The string value to be validated. | Yes |
pattern |
The regular expression pattern (required if type is regex). |
No |
options |
A comma-separated list of allowed values (required if type is enum). |
No |
npm installnpm run buildnpm run lintThis project is released into the public domain under the Unlicense.