Schedule icon
Request icon
Script icon
If icon
Loop icon
ChatCompletion icon
SlackIncomingWebhook icon
Log icon

AI GitHub Issue Triage Sentinel with Urgent Slack Alerts

Triage GitHub issues with OpenAI structured JSON schema and trigger actionable Slack alerts for critical and high-priority bugs while logging routine issues.

Categories
AIBusiness

Automate triage for GitHub repositories with schema-constrained AI classification and intelligent alert routing. This blueprint pulls recent issues via the GitHub REST API, filters out pull requests and truncates oversized bodies, iterates through each issue using a controlled Loop, classifies severity and categorization via OpenAI ChatCompletion backed by strict JSON Schema constraints, and routes only CRITICAL and HIGH priority issues to your on-call Slack channel while recording routine issues in execution logs.

How it works

  1. Triggering: The schedule_triage trigger (io.kestra.plugin.core.trigger.Schedule) executes every 2 hours (shipped disabled: true for safe initial manual testing).
  2. Ingestion: fetch_issues (io.kestra.plugin.core.http.Request) queries GitHub's /issues endpoint for the configured repository, passing Authorization: Bearer {{ secret('GITHUB_TOKEN') }}.
  3. Sanitization: filter_and_prepare_issues (io.kestra.plugin.scripts.python.Script) strips pull request entries, caps body lengths at 3000 characters to prevent prompt injection or token bloat, bounds batch size by inputs.issue_limit, and emits clean structured items.
  4. Guard Gate: check_has_issues (io.kestra.plugin.core.flow.If) verifies whether any issues need evaluation; if none are found, it skips downstream processing cleanly.
  5. AI Evaluation Loop: triage_each_issue (io.kestra.plugin.core.flow.Loop) processes issues concurrently (concurrencyLimit: 2):
    • ai_classify_issue (io.kestra.plugin.openai.ChatCompletion) runs GPT-4o-mini with a strict jsonResponseSchema, constraining model output to priority (CRITICAL, HIGH, MEDIUM, LOW), category, summary, and action_plan.
    • check_urgent_priority (io.kestra.plugin.core.flow.If) safely inspects the parsed priority field.
    • notify_slack_urgent (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) formats and sends an alert card containing issue links, severity badges, and AI recommended next steps.
    • Routine issues (MEDIUM and LOW) are logged via log_routine_triage without notifying Slack.
  6. Summary & Error Handling: triage_summary_log records cycle completion, and a flow-level errors handler dispatches an alert to Slack if an unexpected failure occurs.

What you get

  • Zero Alert Fatigue: Only real emergencies (CRITICAL and HIGH) interrupt engineers on Slack; routine tickets and feature suggestions are triaged quietly in execution logs.
  • Constrained Output Structure: JSON Schema response validation eliminates malformed JSON and enforces the exact fields required for deterministic conditional branching.
  • Safe Token Limits: Truncates issue bodies to avoid token exhaustion and frames issue content strictly as untrusted data.
  • Observable Triage Lineage: Full audit trail of issue classifications and recommended actions within Kestra logs.

Who it's for

  • Open-source maintainers managing high-volume repositories.
  • DevOps and Platform teams running incident response from public or private issue trackers.
  • Engineering managers seeking automated first-pass triage without vendor lock-in.

Why orchestrate this with Kestra

A static webhook or cron script cannot safely enforce API rate limits, retry transient LLM timeouts, isolate loop iterations, and guard against malformed data. Kestra provides declarative flow orchestration: exponential HTTP retries, per-iteration concurrency controls, native secrets management, and detailed execution telemetry for every triaged issue.

Prerequisites

  • A Kestra instance with the HTTP, Script Python, OpenAI, and Slack plugins enabled.
  • A GitHub personal access token (classic or fine-grained) with issues:read permissions.
  • An OpenAI API key with access to chat completion models (default: gpt-4o-mini).
  • A Slack incoming webhook URL for the destination alerts channel.

Secrets

  • GITHUB_TOKEN: GitHub personal access token used by fetch_issues (required).
  • OPENAI_API_KEY: OpenAI API key used by ai_classify_issue (required).
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used by notify_slack_urgent and alert_triage_failure (required).

Inputs

  • github_owner (STRING, default: kestra-io): GitHub organization or username.
  • github_repository (STRING, default: kestra): Repository name.
  • issue_limit (INT, default: 5): Maximum issues evaluated per execution batch.
  • issue_state (STRING, default: open): Issue state filter (open or all).
  • ai_model (STRING, default: gpt-4o-mini): OpenAI model identifier.

Outputs

  • outputs.total_issues_inspected: Total number of GitHub issues processed.
  • outputs.repository: Target repository path in owner/repo format.

Quick start

  1. Configure the three required secrets in your Kestra namespace (GITHUB_TOKEN, OPENAI_API_KEY, SLACK_WEBHOOK_URL).
  2. Import this blueprint YAML into your Kestra instance.
  3. Run a manual execution with your repository inputs to verify issue ingestion, AI classification, and log output.
  4. Verify that any critical or high-priority issues trigger a rich Slack alert card.
  5. Enable the schedule_triage trigger in the flow editor to activate automated periodic triage.

How to extend

  • Automated Labeling: Add io.kestra.plugin.github.issues.Comment or a GitHub labels task to apply AI-derived labels (bug, priority:high) back to GitHub.
  • Multi-Repo Fanout: Enclose the flow within a parent workflow or pass a list of repositories to loop over an entire organization.
  • Alternative AI Providers: Swap io.kestra.plugin.openai.ChatCompletion for io.kestra.plugin.ai.agent.AIAgent with Google Gemini, Anthropic Claude, or local Ollama.
  • PagerDuty Escalation: Route CRITICAL issues to PagerDuty or Opsgenie in parallel with Slack notifications.

Common pitfalls

  • Pull requests appearing as issues: The GitHub REST API returns both issues and pull requests on the /issues route. This blueprint handles this automatically in filter_and_prepare_issues by checking the presence of the pull_request key.
  • Rate limits on unauthenticated GitHub requests: Always provide GITHUB_TOKEN to ensure the 5,000 requests/hour authenticated quota.
  • Untrusted issue content: Public issue bodies can contain arbitrary text. The system prompt instructs the model to treat all issue text as data and never execute embedded instructions. While JSON Schema guarantees response format, human review is recommended before taking irreversible remediation actions.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.