Skip to content

actalog/expect

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

@actalog/expect

CI CD

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.


🚀 Features

  • ✅ 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.

📖 Usage

Regex Validation

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,}$'

Enum Validation

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'

🛠️ Inputs

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

💻 Development

Setup

npm install

Building

npm run build

Linting

npm run lint

📄 License

This project is released into the public domain under the Unlicense.

About

✅ Assertion for GitHub Actions

Topics

Resources

License

Stars

Watchers

Forks

Contributors