0.5.2 • Published 3 years ago

sendgrid-sync v0.5.2

Weekly downloads
27
License
MIT
Repository
github
Last release
3 years ago

action-sendgrid-sync

GitHub action to sync handlebars template with sendgrid

Basic usage (using with Github Actions)

Example workflow

- id: sendgrid-sync
  name: SendGrid sync
  uses: nanopx/action-sendgrid-sync@0.5.2
  with:
    githubToken: ${{ secrets.GITHUB_TOKEN }}
    sendgridApiKey: ${{ secrets.SENDGRID_API_KEY }}
    templatesDir: 'templates/sendgrid/'
    partialsDir: 'templates/sendgrid/partials/'
    templatePrefix: ${{ env.STAGE }}/
    subjectTemplate: '{{subject}}'
    preserveVersions: 2
    outputFile: ./mapping.json
    forceSyncAll: false
    dryRun: false

Inputs:

NameRequirementDescription
githubTokenrequiredGitHub personal access token
sendgridApiKeyrequiredSendGrid API Key
templatesDirrequiredTemplates directory
partialsDiroptionalPartials directory
templatePrefixoptionalTemplate name prefix
subjectTemplateoptionalSubject template. Defaults to {{subject}}
preserveVersionsoptionalNumber of versions to preserve per template. Defaults to '2'
outputFileoptionalOutput file path for the mapping json
dryRunoptionalEnable dry run mode
forceSyncAlloptionalForce sync all files in templates dir (Useful for initial synchronization)

Outputs:

  • sendgridTemplateIdMapping: JSON string which contains a mapping of template name(key) and template id(value)

CLI Usage

$ npx sendgrid-sync -h

  Usage
    $ sendgrid-sync <templatesDir>

  Options
    --partials-dir, -p  Path to partials directory
    --api-key, -a       SendGrid API key (Recommended to use 'SENDGRID_API_KEY' environment variable)
    --template-prefix   Template name prefixes
    --subject-template  Subject template
    --target, -t        Target template base names (names without the prefix specified with '--template-prefix')
    --preserve-versions Number of versions to preserve per template
    --dry-run           Dry run
    --output-file, -o   Output template mapping json to file

  Examples
    $ SENDGRID_API_KEY=<SENDGRID_API_KEY> sendgrid-sync ./path/to/templates -p ./path/to/templates/partials
    Sync all templates with SendGrid

Sync all templates with SendGrid

$ npx sendgrid-sync path/to/templates/ -p path/to/partials/

Create a new version with prefix for specified templates

$ npx sendgrid-sync path/to/templates/ -p path/to/partials/ --template-prefix dev/ -t target_template_name_1 -t target_template_name_2
0.5.2

3 years ago

0.4.4

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.3

3 years ago

0.5.1

3 years ago

0.4.2

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago