Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/garnertb/template-action
GitHub Action that provides advanced formatting control using Handlebars.
https://github.com/garnertb/template-action
Last synced: 2 months ago
JSON representation
GitHub Action that provides advanced formatting control using Handlebars.
- Host: GitHub
- URL: https://github.com/garnertb/template-action
- Owner: garnertb
- License: mit
- Created: 2022-08-25T17:52:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-06T17:33:00.000Z (8 months ago)
- Last Synced: 2024-10-12T17:46:30.996Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 748 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# template-action
Action that uses [handlebars](https://handlebarsjs.com/) to render arbitrary template payloads.
## Usage
Any variables passed will be used as context for the template.
### Simple example
```yaml
uses: garnertb/template-action@v1
with:
template: Whats up {{ name }}?
name: Mona# Returns
# >> Whats up Mona?
```### More complex example
This example creates a summary issue with all issues updated in the last week.
```yaml
# Query recently updated issues
- uses: octokit/[email protected]
id: open-issues
with:
route: /repos/:owner/:repo/issues?sort=updated&per_page=100&state=all
owner: garnertb
repo: template-action
env:
GITHUB_TOKEN: ${{ secrets.token }}# Use template-action to generate the issue body
- uses: garnertb/template-action@v1
id: issue-body
with:
issues: ${{ steps.open-issues.outputs.data }}
template: |
## Open issues
{{ #each issues }}
{{ #withinAWeek this.updated_at }}
- [ ] #{{ this.number }}
{{ /withinAWeek }}
{{ /each }}# Create summary issue from template payload
- uses: imjohnbo/issue-bot@v3
with:
body: ${{ steps.issue-body.outputs.payload }}
title: Issues from this week
```Generated issue:
![issue image](images/issue.jpg)