Source
yaml
id: ai-summarize-weekly-git-commits
namespace: company.team
inputs:
  - id: repository
    type: URI
    defaults: https://github.com/kestra-io/blueprints
    description: Repository to summarize last week's progress
  - id: branch
    type: STRING
    defaults: main
    description: Git branch to summarize last week's progress
tasks:
  - id: wdir
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: clone_repo
        type: io.kestra.plugin.git.Clone
        branch: "{{ inputs.branch }}"
        url: "{{ inputs.repository }}"
        # username: your-git-user-name # Needed only for private repos
        # password: "{{ secret('GITHUB_ACCESS_TOKEN') }}" # Needed only for private repos
      - id: fetch_commits
        type: io.kestra.plugin.scripts.shell.Commands
        taskRunner:
          type: io.kestra.plugin.scripts.runner.docker.Docker
        containerImage: bitnami/git:latest
        commands:
          # 0. Set safe.directory for Git to avoid "dubious ownership" errors
          - git config --global --add safe.directory "$(pwd)"
          # 1. Deepen clone if shallow
          - git fetch --unshallow origin {{ inputs.branch }} || true
          # 2. Update main branch
          - git fetch origin {{ inputs.branch }}
          # 3. Fetch commits from the last 7 days (weekly)
          - git log origin/{{ inputs.branch }} --since="7 days ago"
            --pretty=format:"%h %ad %s" --date=short > commits.txt
          # 4. Show how many were found
          - echo "Fetched $(wc -l < commits.txt) commits from the last 7 days"
        outputFiles:
          - commits.txt
      - id: summarize_commits
        type: io.kestra.plugin.openai.Responses
        apiKey: "{{ secret('OPENAI_API_KEY') }}"
        model: gpt-4o
        input: |
          Summarize the following Git commits into a clear and concise weekly development update for users.
          Output plain text for Slack, no markdown or extra formatting.
          Here are the commit messages:
          {{ read(outputs.fetch_commits.outputFiles['commits.txt']) }}       
          Ensure no markdown syntax like **bold text** in the response — stick to plain text!
  - id: slack
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: https://kestra.io/api/mock # replace with "{{secret('SLACK_WEBHOOK_URL')}}" for production
    payload: |
      {{
        {
          "text": "This week's repository updates for " ~ inputs.repository ~ ". " ~ outputs.summarize_commits.outputText 
        }
      }}
triggers:
  - id: weekly-trigger
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 15 * * 5" # Every Friday at 15:00 (3:00 PM) UTC
description: |
  This Kestra flow provides an automated, weekly summary of Git commit activity for a specified repository and branch. Every Friday at 3 PM UTC, it:
    - Clones the target Git repository (default: main branch)
    - Fetches all commits from the last 7 days
    - Uses OpenAI to generate a plain-text summary of the week’s changes
    - Posts the update to a Slack channel via webhook
  The flow is configurable for any repository and branch, and is suitable for both public and private repositories (with proper secrets). This ensures all stakeholders receive a concise, human-readable recap of project progress each week, directly in Slack.
About this blueprint
Notifications AI Git Kestra
This Kestra flow provides an automated, weekly summary of Git commit activity for a specified repository and branch. Every Friday at 3 PM UTC, it:
- Clones the target Git repository (default: main branch)
 - Fetches all commits from the last 7 days
 - Uses OpenAI to generate a plain-text summary of the week’s changes
 - Posts the update to a Slack channel
 
The flow is configurable for any repository and branch, and is suitable for both public and private repositories (with proper secrets). This ensures all stakeholders receive a concise, human-readable recap of project progress each week, directly in Slack.
Configuration:
- Add secrets for the Slack incoming webhook URL, OpenAI API key, and GitHub credentials if needed.
 - Change the repository URL and branch as needed.
 - For public repositories, no credentials are needed.
 - For private repositories, supply GitHub Personal Access Token via Kestra secrets.
 - Modify the schedule by adjusting the CRON expression.
 
This automation keeps teams and stakeholders up-to-date on weekly development activity without manual status reporting.