Blueprints

Create GitHub issue when a workflow fails

About this blueprint

Git Notifications System

This system flow will create a GitHub issue anytime a workflow in a company namespace (or any nested child namespace) fails.

You can customize that system flow by modifying the task, adding more tasks to the flow or adjusting the trigger conditions. Read more about that pattern in the Administrator Guide.

Let's create a flow in the namespace with prefix company that will always fail.

yaml
id: failure_flow
namespace: company.team

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

Whenever you run the failure_flow, it will trigger an execution of the create_github_issue_on_failure flow. As a result, a GitHub issue will be created so that an appropriate action can be taken.

yaml
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.ExecutionStatusCondition
        in:
          - FAILED
          - WARNING
      - type: io.kestra.plugin.core.condition.ExecutionNamespaceCondition
        namespace: company
        comparison: PREFIX

Create

Flow

Execution Status Condition

Execution Namespace Condition

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra