Create icon
Flow icon
ExecutionStatus icon
ExecutionNamespace icon

Automatically Create a GitHub Issue When a Workflow or Job Fails

Automatically create a GitHub issue when a Kestra workflow fails. Capture the execution ID and timestamp, apply labels, and track incidents in GitHub.

Categories
CoreInfrastructure
id: create-github-issue-on-failure
namespace: company.team

tasks:
  - id: create_issue
    type: io.kestra.plugin.github.issues.Create
    jwtToken: "{{ secret('GITHUB_TOKEN') }}"
    repository: kestra-io/kestra
    title: Kestra Workflow Failure
    body: "{{ trigger.executionId }} has failed on {{ taskrun.startDate }}"
    labels:
      - bug
      - workflow

triggers:
  - id: on_failure
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatus
        in:
          - FAILED
          - WARNING
      - type: io.kestra.plugin.core.condition.ExecutionNamespace
        namespace: company
        comparison: PREFIX

Turn silent pipeline failures into tracked, actionable work. This blueprint watches every execution in your namespace and, the moment one ends in FAILED or WARNING, automatically opens a GitHub issue with the failing execution ID, the failure timestamp, and triage labels. Instead of relying on someone noticing a red run, your orchestration failures land directly in the same GitHub backlog your engineers already work from, with a clean audit trail of when each incident occurred.

How it works

  1. The on_failure trigger of type io.kestra.plugin.core.trigger.Flow listens to executions across your instance.
  2. An io.kestra.plugin.core.condition.ExecutionStatus condition limits it to runs ending in FAILED or WARNING.
  3. An io.kestra.plugin.core.condition.ExecutionNamespace condition with comparison: PREFIX scopes the automation to executions whose namespace starts with company.
  4. When both conditions match, the create_issue task (io.kestra.plugin.github.issues.Create) authenticates with jwtToken and opens an issue in the target repository.
  5. The issue body is templated as {{ trigger.executionId }} has failed on {{ taskrun.startDate }}, and labels (bug, workflow) are applied for routing and triage.

What you get

  • Automatic GitHub issue creation on any failed or warning execution.
  • Issues pre-filled with the execution ID and failure timestamp for fast lookup.
  • Consistent labeling (bug, workflow) for filtering and assignment.
  • A durable, searchable audit trail of pipeline incidents in GitHub.
  • Zero manual incident reporting for routine failures.

Who it's for

  • Platform and data engineers who track work in GitHub Issues.
  • On-call and SRE teams that need failures surfaced where they already operate.
  • Teams standardizing incident intake across many flows and namespaces.

Why orchestrate this with Kestra

GitHub Issues has no native awareness of your pipeline runs. Kestra's event-driven Flow trigger fires the instant an execution fails anywhere in your namespace, with no polling and no cron job to babysit. You get declarative YAML conditions, built-in retries on the issue-creation API call, and full execution lineage linking the original failure to the ticket it produced. The underlying GitHub scheduler cannot react to orchestration events, Kestra closes that gap by translating run outcomes into issues in real time.

Prerequisites

  • A Kestra instance with the GitHub plugin available.
  • A GitHub repository where issues can be created (default kestra-io/kestra).
  • A GitHub token with permission to open issues in that repository.

Secrets

  • GITHUB_TOKEN: GitHub personal access token (or app JWT) used for jwtToken.

Quick start

  1. Add the GITHUB_TOKEN secret to your Kestra instance.
  2. Set repository to the repo where incidents should be filed.
  3. Adjust the ExecutionNamespace condition to match your namespace prefix.
  4. Save the flow, then run a flow that fails to confirm an issue appears.

To test, create a flow that always fails:

id: failure_flow
namespace: company.team

tasks:
  - id: always_fails
    type: io.kestra.plugin.core.execution.Fail

How to extend

  • Enrich the issue body with the failed task ID, error message, or a link back to the execution.
  • Narrow or broaden the ExecutionStatus condition (for example, alert only on FAILED).
  • Route by repository or label set per team or namespace.
  • Chain a Slack or email notification task after create_issue for escalation.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.