Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 1.25 KB

README.md

File metadata and controls

58 lines (45 loc) · 1.25 KB

template-action

Action that uses handlebars to render arbitrary template payloads.

Usage

Any variables passed will be used as context for the template.

Simple example

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.

# 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