Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Evans committed Jul 31, 2020
1 parent 4ca04c9 commit 229435c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,27 @@ See the repository for detailed usage.
body-includes: search string 1
```

### Setting the comment body from a file

This example shows how file content can be read into a variable and passed to the action.
The content must be [escaped to preserve newlines](https://github.community/t/set-output-truncates-multiline-strings/16852/3).

```yml
- id: get-issue-body
run: |
body=$(cat my-issue-body.txt)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 1
body: ${{ steps.get-issue-body.outputs.body }}
```

### Accessing issues and comments in other repositories

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

0 comments on commit 229435c

Please sign in to comment.