Skip to content

A GitHub action to check whether a provided variable is a valid email or not.

License

Notifications You must be signed in to change notification settings

kylesoskin/email-validation-github-action

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

email-validation-github-action

A GitHub action to check whether provided variable(s) are valid emails or not.

Inputs

email

Required The email(s) to validate.

Outputs

results

The results in the form [{${email}: [true|false]}]

For example

input: '[email protected], [email protected], not_an_email'

Would produce a result/GitHub output of

output: '[{"[email protected]":true},{"[email protected]":true},{"not_an_email":false}]'

Which can be used in upstream Github actions by doing something like

JSON.parse(github.email_validate_step.outputs.results)

Although most of the time if you just need to know if a single email is valid or not you can just rely on the job failing when it is not OR by checking the success value of the validation step.

Example usage

uses: kylesoskin/email-validation-github-action@v2
with:
  email: '[email protected]'
uses: kylesoskin/email-validation-github-action@v2
with:
  email: '[email protected], otheremailtocheck'
uses: kylesoskin/email-validation-github-action@v2
with:
  email: ${{ env.EMAIL }}

Full working workflow example

# This is a basic workflow to help you get started with this action

name: Test email validation action

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  workflow_dispatch:
    inputs:
      email:
        description: 'Email'
        required: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: kylesoskin/email-validation-github-action@v2
        with: 
          email: ${{ github.event.inputs.email }}

About

A GitHub action to check whether a provided variable is a valid email or not.

Resources

License

Stars

Watchers

Forks

Packages

No packages published