Skip to content

Commit

Permalink
Merge pull request #4 from yumemi-inc/update_readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hkusu authored Nov 22, 2023
2 parents 26d92c3 + 38c3ed0 commit c920856
Showing 1 changed file with 41 additions and 8 deletions.
49 changes: 41 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ Previous comments by the same job are deleted (or hidden or edited), thus avoidi
See [action.yml](action.yml) for available action inputs.
Note that this action requires `pull-requests: write` permission.

### Minimal usage
### Basic

You only need to specify `comment` input.
Specify `comment` input.

```yaml
- uses: yumemi-inc/comment-pull-request@v1
with:
comment: |
Pull request check passed successfully.
# Test coverage report
...
```
In this case, previous comments will be deleted.
Expand All @@ -33,12 +35,14 @@ Specify one of `delete` (default), `hide`, `edit`, or `keep` (do nothing).
with:
previous-comment: 'hide'
comment: |
Pull request check passed successfully.
# Test coverage report
...
```

Comments are grouped by the value of `grouping-key` input (default is `${{ github.workflow }}-${{ github.job }}`), and comments in the same group are subject to deletion, etc.

## Tips
### Comments on failure

It is often necessary to separate the contents of comments when a check passes and when it fails. You can define it in one step by using `comment-if-failure` input.

Expand All @@ -48,9 +52,38 @@ It is often necessary to separate the contents of comments when a check passes a
if: cancelled() != true
with:
comment: |
Pull request check passed successfully.
:white_check_mark: All tests passed.
comment-if-failure: |
@${{ github.actor }} Pull request check failed.
:no_entry_sign: Some tests failed.
See test results from ...
```

## Tips

### User mention

Write the account name after `@`.
For example, to mention the creator of a pull request, write as follows:

```yaml
comment: |
@${{ github.actor }} A critical error has occurred.
```

### Guide to job logs and summaries

The URL for the job log and summary is `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}`.

About job summary: [Supercharging GitHub Actions with Job Summaries](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)

See details [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
To guide this URL with comments, write as follows;

```yaml
comment: |
Some tests failed.
See details from [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
```

It is recommended to write reports such as test results and coverage in the summary rather than in comments.

0 comments on commit c920856

Please sign in to comment.