-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
119 lines (108 loc) · 3.92 KB
/
action.yml
File metadata and controls
119 lines (108 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: "Git AI Dashboards"
description: "Track AI-assisted development and export OpenTelemetry data for your repository"
author: "acunniffe"
branding:
icon: "git-branch"
color: "purple"
inputs:
git-ai-version:
description: "Version of git-ai to install (e.g., 'v1.0.23'). Defaults to latest release."
required: false
default: "latest"
git-ai-repo:
description: "GitHub repo to download git-ai from (owner/repo format)."
required: false
default: "acunniffe/git-ai"
github-token:
description: "GitHub token for API access"
required: false
default: ${{ github.token }}
pr-url:
description: "Pull request URL (triggers PR mode when provided)"
required: false
repo-url:
description: "Repository URL"
required: false
default: ${{ github.server_url }}/${{ github.repository }}
merge-commit-sha:
description: "Merge commit SHA (required when pr-url is provided)"
required: false
default-branch:
description: "Default branch name (for daily export mode)"
required: false
default: "main"
OTEL_EXPORTER_OTLP_ENDPOINT:
description: "OpenTelemetry endpoint URL"
required: false
OTEL_EXPORTER_OTLP_HEADERS:
description: "OpenTelemetry headers (key=value format, comma separated)"
required: false
OTEL_SERVICE_NAME:
description: "OpenTelemetry service name"
required: false
runs:
using: "composite"
steps:
- name: Install git-ai
if: inputs.pr-url != ''
shell: bash
run: |
VERSION="${{ inputs.git-ai-version }}"
REPO="${{ inputs.git-ai-repo }}"
if [ "$VERSION" = "latest" ]; then
VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | jq -r '.tag_name')
fi
INSTALL_URL="https://github.com/${REPO}/releases/download/${VERSION}/install.sh"
HTTP_STATUS=$(curl -fsSL -w "%{http_code}" -o /tmp/install.sh "$INSTALL_URL" 2>/dev/null || echo "000")
if [ "$HTTP_STATUS" != "200" ]; then
echo "Error: Failed to download install.sh for version ${VERSION}"
exit 1
fi
bash /tmp/install.sh
rm /tmp/install.sh
echo "$HOME/.git-ai/bin" >> $GITHUB_PATH
- name: Install git-ai-otel
shell: bash
run: |
curl -fsSL https://git-ai-otel.s3.us-east-2.amazonaws.com/git-ai-otel-latest.tar.gz -o git-ai-otel.tar.gz
tar -xzf git-ai-otel.tar.gz
chmod +x git-ai-otel
sudo mv git-ai-otel /usr/local/bin/
- name: Configure git user
if: inputs.pr-url != ''
shell: bash
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Run git-ai CI
if: inputs.pr-url != ''
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
export PATH="$HOME/.git-ai/bin:$PATH"
git-ai ci github run
- name: Export PR OpenTelemetry data
if: inputs.pr-url != ''
shell: bash
env:
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ inputs.OTEL_EXPORTER_OTLP_ENDPOINT }}
OTEL_EXPORTER_OTLP_HEADERS: ${{ inputs.OTEL_EXPORTER_OTLP_HEADERS }}
OTEL_SERVICE_NAME: ${{ inputs.OTEL_SERVICE_NAME }}
run: |
git-ai-otel export-pr "${{ inputs.pr-url }}" "${{ inputs.repo-url }}" merged "${{ inputs.merge-commit-sha }}"
- name: Export daily OpenTelemetry data
if: inputs.pr-url == ''
shell: bash
env:
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ inputs.OTEL_EXPORTER_OTLP_ENDPOINT }}
OTEL_EXPORTER_OTLP_HEADERS: ${{ inputs.OTEL_EXPORTER_OTLP_HEADERS }}
OTEL_SERVICE_NAME: ${{ inputs.OTEL_SERVICE_NAME }}
run: |
git fetch
git-ai-otel export "${{ inputs.default-branch }}" "${{ inputs.repo-url }}" --report markdown
- name: Write daily report summary
if: inputs.pr-url == ''
shell: bash
run: |
cat report.md >> $GITHUB_STEP_SUMMARY