Awesome
Action EJS
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"
}
- name: action-ejs
uses: jaywcjlove/action-ejs@main
with:
template-file: template/demo.html
output: build/template/demo.html
vars: |
{ "htmlContent": "${{ env.GITHUB_REF }}" }
Following objects are exposed, and can be used in template file:
context
: The Context object in @actions/githubprocess
: Theprocess.env
object. You can access the environment variables withenv.<key>
- name: action-ejs
uses: jaywcjlove/action-ejs@main
with:
template: |
<h1><%= env.GITHUB_REF %></h1> commiter: <%= context.payload.head_commit.author.name %>
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 avars
.default: '{}'
options
A JSON format string of options to be passed to the template engine.default: '{}'
output
output html pathdefault: build/index.html
Outputs
content
template render result:<!DOCTYPE html><html lang="en">....
.
See Also
- Github Release Changelog Generator A GitHub Action that compares the commit differences between two branches
- Create Tags From Auto create tags from commit or package.json.
- Github Action Contributors Github action generates dynamic image URL for contributor list to display it!
- Generated Badges Create a badge using GitHub Actions and GitHub Workflow CPU time (no 3rd parties servers)
- Create Coverage Badges Create coverage badges from coverage reports. (no 3rd parties servers)
- Github Action package Read and modify the contents of
package.json
.
Contributors
As always, thanks to our amazing contributors!
<a href="https://github.com/jaywcjlove/action-ejs/graphs/contributors"> <img src="https://jaywcjlove.github.io/action-ejs/CONTRIBUTORS.svg" /> </a>Made with action-contributors.
License
Licensed under the MIT License.