Namchee / dupliket

Triage issues and discussions efficiently by resolving duplicate references with LLM 🧠

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dupliket

Dupliket is a GitHub action that helps repository maintainers to triage issues and discussions efficiently by finding duplicates and reference them directly in the newly created issue or discussion. It is powered by LLM provided by OpenAI to process issues and calculate their similarites.

Installation

You can integrate Dupliket in your GitHub workflow by creating a new workflow file, for example:

on:
  issues:
    types: [opened]

jobs:
  dupliket:
    runs-on: ubuntu-latest
    steps:
      - name: Find possible duplicates
        uses: Namchee/dupliket@<version>
        with:
          access_token: ${{ secrets.GITHUB_TOKEN }}
          api_key: ${{ secrets.API_KEY }}

Supported Events

Dupliket supports the following workflow events:

Event Types Description
issues created Fired whenever a new issue is created.
discussion opened Fired whenever a new discussion is created.

Please refer to the workflow events reference for more information about the supported events.

Since GitHub includes pull request on issues events, it is recommended to filter pull request events when listening to issues events. You can filter pull request using job conditions in your workflow file. For example:

on:
 issues:
   types: [opened]

jobs:
 dupliket:
   runs-on: ubuntu-latest
   if: ${{ !github.event.issue.pull_request }} # Do not listen to pull request events
   steps:
     - name: Find possible duplicates
       uses: Namchee/dupliket@<version>
       with:
         access_token: ${{ secrets.GITHUB_TOKEN }}
         api_key: ${{ secrets.API_KEY }}

Inputs

Dupliket accepts the following input that can be filled in jobs.with section:

Name Required? Default Value Description
access_token true This field is required GitHub's access token. Used to interact with GitHub API for managing knowledge and creating comments. Note: Ensure that your token have permissions to read and write code and issues
api_key true This field is required OpenAI's API key. You can get it by signing up for an OpenAI account
model false text-embedding-ada-002 Language model to be used when searching and calculating issue and discussion similarity.
max_issues false 3 Maximum number of possibly similar issues and discussions to be displayed
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
discussions false true Include discussions when searching for similar references
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 for more detailed information on how to use this field.

Customizing Message

By default, dupliket will create a message containing references existing issues and discussions when an issue or discussion is created and has potential duplicates. While this is good enough for normal use-cases, you might want to change the message to suit your needs or want to change the formatting instead.

You can customize the message by providing a mustache template to template option in the workflow file. Markdown formatting is supported.

Below are the list of replacable values that you can use in your custom message:

Name Description
user Username that triggers the event
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/dupliket/issues/49
- https://github.com/Namchee/dupliket/issues/48

License

This project is licensed under the MIT License

About

Triage issues and discussions efficiently by resolving duplicate references with LLM 🧠

License:MIT License


Languages

Language:TypeScript 98.7%Language:JavaScript 0.9%Language:Shell 0.4%