Git AI

GitHub Action

Configure Git AI metrics export in GitHub Actions

Quick Start

Copy this workflow file to .github/workflows/git-ai.yml in your repository:

name: Git AI Dashboards
on:
  pull_request:
    types: [closed]
  schedule:
    - cron: "0 0 * * *" # Daily at midnight UTC
  workflow_dispatch:

jobs:
  pr-close:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    continue-on-error: true
    permissions:
      contents: write
    steps:
      - name: Run Git AI PR Close
        uses: git-ai-project/action/pr-close@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          pr-url: ${{ github.event.pull_request.html_url }}
          merge-commit-sha: ${{ github.event.pull_request.merge_commit_sha }}
          OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
          OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
          OTEL_SERVICE_NAME: "git-ai-dashboards"

  daily-metrics:
    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
    runs-on: ubuntu-latest
    continue-on-error: true
    permissions:
      contents: read
    steps:
      - name: Run Git AI Daily Metrics
        uses: git-ai-project/action/daily-metrics@v1
        with:
          OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
          OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
          OTEL_SERVICE_NAME: "git-ai-dashboards"

Actions

This repository provides two specialized actions:

git-ai-project/action/pr-close

Runs when a pull request is merged. Analyzes the PR for AI-assisted contributions and exports the PR-level metrics (defined here).

Inputs

InputRequiredDefaultDescription
github-tokenNo${{ github.token }}GitHub token for API access
pr-urlYes-The pull request URL (use ${{ github.event.pull_request.html_url }})
merge-commit-shaYes-The merge commit SHA (use ${{ github.event.pull_request.merge_commit_sha }})
repo-urlNoCurrent repositoryRepository URL
OTEL_EXPORTER_OTLP_ENDPOINTNo-OpenTelemetry endpoint URL
OTEL_EXPORTER_OTLP_HEADERSNo-OpenTelemetry headers (key=value format, comma separated)
OTEL_SERVICE_NAMENo-OpenTelemetry service name

Required Permissions

Git AI needs contents.write permission for the PR Close action so it can push a new Authorship Git Note in the event a PR was "Squash and Merged" or "Rebase and Merged".

permissions:
  contents: write  # Required to read repository and commit history

git-ai-project/action/daily-metrics

Runs on a schedule to export aggregate daily metrics for the repository.

Inputs

InputRequiredDefaultDescription
repo-urlNoCurrent repositoryRepository URL
default-branchNoRepository default branchDefault branch name to analyze
OTEL_EXPORTER_OTLP_ENDPOINTNo-OpenTelemetry endpoint URL
OTEL_EXPORTER_OTLP_HEADERSNo-OpenTelemetry headers (key=value format, comma separated)
OTEL_SERVICE_NAMENo-OpenTelemetry service name

Required Permissions

permissions:
  contents: read  # Required to read repository and commit history

OpenTelemetry Configuration

To export metrics to your observability platform, add the following secrets to your repository:

  1. Go to SettingsSecrets and variablesActions
  2. Add the following secrets:
SecretDescription
OTEL_EXPORTER_OTLP_ENDPOINTYour OTLP endpoint URL
OTEL_EXPORTER_OTLP_HEADERSAuthentication headers

Provider Examples

Grafana Cloud

OTEL_EXPORTER_OTLP_ENDPOINT: https://otlp-gateway-prod-us-central-0.grafana.net/otlp
OTEL_EXPORTER_OTLP_HEADERS: Authorization=Basic <base64-encoded-credentials>

Honeycomb

OTEL_EXPORTER_OTLP_ENDPOINT: https://api.honeycomb.io
OTEL_EXPORTER_OTLP_HEADERS: x-honeycomb-team=<your-api-key>

Datadog

OTEL_EXPORTER_OTLP_ENDPOINT: https://otel.datadoghq.com
OTEL_EXPORTER_OTLP_HEADERS: DD-API-KEY=<your-api-key>

New Relic

OTEL_EXPORTER_OTLP_ENDPOINT: https://otlp.nr-data.net
OTEL_EXPORTER_OTLP_HEADERS: api-key=<your-license-key>