Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-evans committed Apr 9, 2021
1 parent ac60f19 commit 90e17f0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/comment-template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
This is a test comment template

Render template variables such as {{ .foo }} and {{ .bar }}.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,32 @@ The content must be [escaped to preserve newlines](https://github.community/t/se
body: ${{ steps.get-comment-body.outputs.body }}
```

### Using a markdown template

In this example, a markdown template file is added to the repository at `.github/comment-template.md` with the following content.
```
This is a test comment template
Render template variables such as {{ .foo }} and {{ .bar }}.
```

The template is rendered using the [render-template](https://github.com/chuhlomin/render-template) action and the result is used to create the comment.
```yml
- name: Render template
id: template
uses: chuhlomin/render-template@v1.2
with:
template: .github/comment-template.md
vars: |
foo: this
bar: that
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 1
body: ${{ steps.template.outputs.result }}
```

### Accessing issues and comments in other repositories

You can create and update comments in another repository by using a [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) instead of `GITHUB_TOKEN`.
Expand Down

0 comments on commit 90e17f0

Please sign in to comment.