# Tekton EventListener for Bakery-IA CI/CD
# This listener receives webhook events and triggers pipelines

apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
  name: bakery-ia-event-listener
  namespace: {{ .Release.Namespace }}
  labels:
    app.kubernetes.io/name: {{ .Values.labels.app.name }}
    app.kubernetes.io/component: triggers
spec:
  serviceAccountName: {{ .Values.serviceAccounts.triggers.name }}
  triggers:
    - name: bakery-ia-gitea-trigger
      interceptors:
        - ref:
            name: "cel"
            kind: ClusterInterceptor
          params:
            - name: "filter"
              value: "has(body.repository) && body.ref.contains('main')"
      bindings:
        - ref: bakery-ia-trigger-binding
      template:
        ref: bakery-ia-trigger-template