-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
105 lines (96 loc) · 3.71 KB
/
action.yml
File metadata and controls
105 lines (96 loc) · 3.71 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
name: OpsAgent RCA
description: AI-powered CI failure first responder. Analyses build logs and git history to produce a structured Root Cause Analysis.
author: ChengaDev
branding:
icon: search
color: red
inputs:
log-path:
description: Path to the CI/CD build log file
required: true
workspace:
description: Path to the git workspace root
required: false
default: ${{ github.workspace }}
provider:
description: LLM provider — anthropic (default), openai, google
required: false
default: anthropic
api-key:
description: API key for the chosen provider. Falls back to ANTHROPIC_API_KEY / OPENAI_API_KEY / GOOGLE_API_KEY env var.
required: false
model:
description: Model for RCA synthesis. Defaults to the provider's recommended model.
required: false
investigate-model:
description: Model for the investigation tool-call loop. Defaults to the provider's fast model.
required: false
slack-webhook:
description: Slack Incoming Webhook URL for posting the RCA summary.
required: false
webhook-url:
description: Generic HTTPS webhook URL (Discord, Teams, PagerDuty, custom).
required: false
github-token:
description: GitHub token for posting the RCA as a PR comment.
required: false
output:
description: File path to write the RCA report to (in addition to stdout).
required: false
quiet:
description: Suppress progress messages.
required: false
default: 'false'
runs:
using: composite
steps:
- name: Validate configuration
shell: bash
run: |
provider="${{ inputs.provider }}"
api_key="${{ inputs.api-key }}"
if [[ -n "$api_key" ]]; then
exit 0
fi
missing=""
if [[ "$provider" == "anthropic" && -z "$ANTHROPIC_API_KEY" ]]; then
missing="ANTHROPIC_API_KEY"
elif [[ "$provider" == "openai" && -z "$OPENAI_API_KEY" ]]; then
missing="OPENAI_API_KEY"
elif [[ "$provider" == "google" && -z "$GOOGLE_API_KEY" ]]; then
missing="GOOGLE_API_KEY"
fi
if [[ -n "$missing" ]]; then
echo "::error::OpsAgent: $missing is not set. Add it as a repository secret and pass it via the env block."
echo "## OpsAgent — Configuration Error" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Missing secret:** \`$missing\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Add it under **Settings → Secrets and variables → Actions → New repository secret**." >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install OpsAgent
shell: bash
run: pip install "${{ github.action_path }}[all-providers]" --quiet
- name: Run OpsAgent
shell: bash
env:
SLACK_WEBHOOK_URL: ${{ inputs.slack-webhook }}
WEBHOOK_URL: ${{ inputs.webhook-url }}
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
args=(
--log-path "${{ inputs.log-path }}"
--workspace "${{ inputs.workspace }}"
--provider "${{ inputs.provider }}"
)
[[ -n "${{ inputs.api-key }}" ]] && args+=(--api-key "${{ inputs.api-key }}")
[[ -n "${{ inputs.model }}" ]] && args+=(--model "${{ inputs.model }}")
[[ -n "${{ inputs.investigate-model }}" ]] && args+=(--investigate-model "${{ inputs.investigate-model }}")
[[ -n "${{ inputs.output }}" ]] && args+=(--output "${{ inputs.output }}")
[[ "${{ inputs.quiet }}" == "true" ]] && args+=(--quiet)
opsagent "${args[@]}"