Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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)