Skip to content

Commit

Permalink
docs: add example for templating
Browse files Browse the repository at this point in the history
  • Loading branch information
Namchee committed Oct 12, 2023
1 parent a7d061b commit 7fbbe92
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/duplikat-issue-opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ jobs:
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
api_key: ${{ secrets.OPENAI_KEY }}
template: |
Hi {{ user }},
Thanks for reporting an issue! However, it seems like there are {{ count }} issue(s) that are similar to yours:
{{ references }}
show_similarity: true
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You can customize this actions with these following options (fill it on `with` s
| `min_similarity` | `false` | `0.9` | Minimum similarity for an issue or discussion to be considered as similar. Must be a floating point between `0.0` and `1.0` |
| `show_similarity` | `false` | `false` | Include similarity percentage as [footnote](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#footnotes) |
| `label` | `false` | | Label to be applied when an issue or discussion has duplicates. Fill with an empty string to not apply any labels |
| `template` | `false` | | Apply a custom message when an issue or discussion has duplicates. See section [customizing message](#customizing-message) for more detailed information on how to use this field.
| `template` | `false` | | Apply a custom message when an issue or discussion has duplicates. See section [customizing message](#customizing-message) for more detailed information on how to use this field.

### Customizing Message

Expand All @@ -56,6 +56,28 @@ Below are the list of replacable values that you can use in your custom message:
| `count` | Number of similar issues and discussions |
| `references` | List of issue and discussion links |

For example, given the below template:

```
Hi {{ user }},
Thanks for reporting an issue! However, it seems like there are {{ count }} issue(s) that are similar to yours:
{{ references }}
```

the action may reply with the following comment

```
Hi @Namchee,

Thanks for reporting an issue! However, it seems like there are 3 issue(s) that are similar to yours:

- https://github.com/Namchee/duplikat/issues/49
- https://github.com/Namchee/duplikat/issues/48

```
## License
This project is licensed under the [MIT License](./LICENSE)
2 changes: 1 addition & 1 deletion dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7fbbe92

Please sign in to comment.