Webhook icon
If icon
OutputValues icon
Search icon
Loop icon
Request icon
ChatCompletion icon
Comment icon
Log icon

AI GitHub issue duplicate detector

On a new GitHub issue, Kestra loads recent keyword matches and comments when a model calls one a duplicate.

Categories
AIBusiness

When a GitHub issue is opened, this flow searches for recent open issues with similar titles, fetches their bodies, and uses AI to determine whether one describes the same bug. If a duplicate is detected, the flow comments on the new issue with the matching issue and explanation.

The four inputs are only for a manual test. A webhook run reads the issue from trigger.body. A manual execution has no trigger, so the first If treats that as a test run and the issue task reads the inputs.

GitHub search can lag a minute after an issue is created, so the first webhook run may find no candidates even when a duplicate exists. A title that contains quotes, colons, or # can also make the search query invalid.

Prerequisites

  • GitHub and OpenAI plugins

Secrets

  • GITHUB_TOKEN: token with permission to search issues, read issue bodies, and post comments.
  • GITHUB_WEBHOOK_KEY: secret embedded in the webhook URL so only GitHub can start the flow.
  • OPENAI_API_KEY: key for the gpt-4o-mini ChatCompletion call.

Expected outputs

  • outputs.verdict.values.duplicate: true when the model calls one candidate the same bug.
  • outputs.verdict.values.issue_number: matching issue number, or 0 when nothing matches.
  • outputs.verdict.values.title: title of the matching issue.
  • outputs.verdict.values.reason: one-line explanation posted in the comment.

These outputs exist only when at least one other recent open issue matched the title search. Otherwise the flow logs that no candidates were found.

Quick start

  1. Configure the three secrets above.
  2. Set repository, issue_number, issue_title, and issue_body to a real open issue.
  3. Run the flow manually. With no webhook payload, it uses those inputs.
  4. Point a GitHub Issues webhook at this flow's URL and send opened events.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.