Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
file-text

GitHub Action

action-ejs

v1.0.0

action-ejs

file-text

action-ejs

A github action to render a ejs template using github context

Installation

Copy and paste the following snippet into your .yml file.

              

- name: action-ejs

uses: jaywcjlove/action-ejs@v1.0.0

Learn more about this action in jaywcjlove/action-ejs

Choose a version

Action EJS

CI TEST

A github action to render a ejs template using github context

Usage

- name: action-ejs
  uses: jaywcjlove/action-ejs@main
  with:
    template: <h1><%= name %> <span><%= conclusion %></span></h1>
    vars: |
      { "name": "${{ github.repository }}", "conclusion": "${{ steps.ejs.conclusion }}" }
- name: action-ejs
  uses: jaywcjlove/action-ejs@main
  with:
    template: <div><%= LICENSE %></div><div><%= markdown %></div>
    output: build/demo.html
    vars-file: |
      {
        "markdown": "./README.md",
        "LICENSE": "./LICENSE"
      }

Following objects are exposed, and can be used in template file:

  • context: The Context object in @actions/github
  • process: The process.env object. You can access the environment variables with env.<key>
- name: action-ejs
  uses: jaywcjlove/action-ejs@main
  with:
    template: |
      <h1><%= env.GITHUB_REF %></h1> commiter: <%= context.payload.head_commit.author.name %>
- name: action-ejs
  uses: jaywcjlove/action-ejs@main
  with:
    template-file: template/demo.html
    output: build/template/demo.html
    vars: |
      { "htmlContent": "${{ env.GITHUB_REF }}" }

Inputs

  • template Input ESJ template string.
  • template-file Input ESJ template file path.
  • vars Input variables. A dictionary of variables in JSON format to be used in the template. default: '{}'
  • vars-file Read the contents of the file into a vars. default: '{}'
  • options A JSON format string of options to be passed to the template engine. default: '{}'
  • output output html path default: build/index.html

Outputs

  • content template render result: <!DOCTYPE html><html lang="en">.....

Contributors

As always, thanks to our amazing contributors!

Made with action-contributors.

License

Licensed under the MIT License.