-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (156 loc) · 5.74 KB
/
engineering-intelligence.yml
File metadata and controls
177 lines (156 loc) · 5.74 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Engineering Intelligence Metrics Collection
on:
schedule:
# Run every 6 hours (4x daily)
- cron: '0 */6 * * *'
workflow_dispatch:
inputs:
org:
description: 'GitHub Organization'
required: true
default: '3horizons'
scope:
description: 'Collection scope'
required: true
default: 'all'
type: choice
options:
- all
- dora
- copilot
- security
period:
description: 'Collection period (days)'
required: true
default: '90'
type: choice
options:
- '30'
- '60'
- '90'
permissions:
contents: read
security-events: read
actions: read
deployments: read
pull-requests: read
issues: read
env:
GITHUB_ORG: ${{ inputs.org || '3horizons' }}
COLLECTION_PERIOD: ${{ inputs.period || '90' }}
DATA_DIR: data/engineering-intelligence
jobs:
collect-github-metrics:
name: 📊 GitHub Engineering Metrics
runs-on: ubuntu-latest
if: ${{ inputs.scope == 'all' || inputs.scope == 'dora' || github.event_name == 'schedule' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install -y jq
- name: Collect GitHub metrics
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x scripts/engineering-intelligence/collect-github-metrics.sh
./scripts/engineering-intelligence/collect-github-metrics.sh \
--org "$GITHUB_ORG" \
--period "$COLLECTION_PERIOD" \
--output summary
- name: Upload metrics artifact
uses: actions/upload-artifact@v4
with:
name: github-metrics-${{ github.run_id }}
path: ${{ env.DATA_DIR }}/github-metrics-*.json
retention-days: 90
collect-copilot-metrics:
name: 🤖 Copilot Analytics
runs-on: ubuntu-latest
if: ${{ inputs.scope == 'all' || inputs.scope == 'copilot' || github.event_name == 'schedule' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install -y jq
- name: Collect Copilot metrics
env:
GH_TOKEN: ${{ secrets.COPILOT_METRICS_TOKEN }}
run: |
chmod +x scripts/engineering-intelligence/collect-copilot-metrics.sh
./scripts/engineering-intelligence/collect-copilot-metrics.sh \
--org "$GITHUB_ORG" \
--output summary
- name: Upload metrics artifact
uses: actions/upload-artifact@v4
with:
name: copilot-metrics-${{ github.run_id }}
path: ${{ env.DATA_DIR }}/copilot-metrics-*.json
retention-days: 90
collect-security-metrics:
name: 🔒 Security Posture
runs-on: ubuntu-latest
if: ${{ inputs.scope == 'all' || inputs.scope == 'security' || github.event_name == 'schedule' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install -y jq
- name: Collect Security metrics
env:
GH_TOKEN: ${{ secrets.SECURITY_METRICS_TOKEN }}
run: |
chmod +x scripts/engineering-intelligence/collect-security-metrics.sh
./scripts/engineering-intelligence/collect-security-metrics.sh \
--org "$GITHUB_ORG" \
--output summary
- name: Upload metrics artifact
uses: actions/upload-artifact@v4
with:
name: security-metrics-${{ github.run_id }}
path: ${{ env.DATA_DIR }}/security-metrics-*.json
retention-days: 90
generate-report:
name: 📋 Generate Report
runs-on: ubuntu-latest
needs: [collect-github-metrics, collect-copilot-metrics, collect-security-metrics]
if: always()
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all metrics
uses: actions/download-artifact@v4
with:
path: ${{ env.DATA_DIR }}
merge-multiple: true
- name: Generate consolidated report
run: |
echo "📊 Engineering Intelligence Report" > report.md
echo "Generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> report.md
echo "Organization: $GITHUB_ORG" >> report.md
echo "Period: Last ${COLLECTION_PERIOD} days" >> report.md
echo "" >> report.md
# Merge all JSON files into a summary
for f in ${DATA_DIR}/*.json; do
if [ -f "$f" ]; then
echo "Processing: $f"
echo "## $(basename "$f" .json)" >> report.md
jq -r 'if .totals then "Total Open Alerts: \(.totals.total_open_alerts // "N/A")" elif .summary then "Copilot Acceptance Rate: \(.summary.code_completions.acceptance_rate // "N/A")%" else "Data collected successfully" end' "$f" >> report.md
echo "" >> report.md
fi
done
- name: Upload consolidated report
uses: actions/upload-artifact@v4
with:
name: ei-report-${{ github.run_id }}
path: report.md
retention-days: 90
- name: Create summary
run: |
echo "## 📊 Engineering Intelligence Collection Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric Category | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----------------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| GitHub Metrics | ${{ needs.collect-github-metrics.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Copilot Analytics | ${{ needs.collect-copilot-metrics.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Security Posture | ${{ needs.collect-security-metrics.result }} |" >> $GITHUB_STEP_SUMMARY