Skip to content

badsyntax/github-action-render-template

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

Render Template GitHub Action

Build & Test Render Template CodeQL

A super simple GitHub Action to render a handlebars template.

Features

  • Renders any handlebars template
  • Accepts any inputs via JSON string
  • Outputs an escaped string that can be used as an input to a different Action

Getting Started

name: 'Render Template'

on:
  pull_request:
    types: [opened, synchronize, reopened]
  push:
    branches:
      - master

jobs:
  deploy:
    name: 'Render'
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2

      - uses: badsyntax/github-action-render-template@v0.0.1
        name: Render Template
        id: render-template
        with:
          template: '.github/pr-comment-template.hbs'
          inputs: |
            {
              "firstName":"Bob",
              "lastName":"Marley"
            }

      - name: Output Rendered Template
        run: |
          echo "Rendered Template: $OUTPUT"
        env:
          OUTPUT: ${{ steps.render-template.outputs.result }}

Action Inputs

Name Description Example
template The path to the handlebars template file ./.github/pr-comment-template.hbs
inputs A JSON string object of key value pairs (can include newlines) {"key":"value"}

Action Outputs

Name Description Example
result Escaped rendered template which can be used an input to a different Action (your rendered template)

Related Projects

Support

License

See LICENSE.md.