-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (125 loc) · 4.76 KB
/
Copy pathopenfix.yml
File metadata and controls
148 lines (125 loc) · 4.76 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
name: OpenFix AI Issue Solver
on:
# Manual trigger with inputs
workflow_dispatch:
inputs:
repo_url:
description: 'Repository URL to analyze'
required: true
default: 'https://github.com/owner/repo'
issue_number:
description: 'Specific issue number (optional)'
required: false
create_pr:
description: 'Create Pull Request if patch generated'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
# Trigger on labeled issues (optional)
issues:
types: [labeled]
# Trigger on schedule (optional - nightly discovery)
schedule:
# - cron: '0 2 * * *' # 2 AM UTC daily uncomment this
jobs:
openfix-automation:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
steps:
- name: Checkout OpenFix
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/openfix
path: openfix
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
cd openfix
pip install -r requirements.txt
- name: Configure credentials
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd openfix
echo "GEMINI_API_KEY=${GEMINI_API_KEY}" >> .env
echo "GITHUB_TOKEN=${GITHUB_TOKEN}" >> .env
- name: Run Issue Discovery
if: github.event_name == 'schedule' || github.event_name == 'issues'
run: |
cd openfix
REPO_URL="${{ github.event.inputs.repo_url || github.repository }}"
python agents/discovery/discover_issues.py "https://github.com/${REPO_URL}" --limit 5
- name: Run Automation Pipeline
id: openfix
run: |
cd openfix
REPO_URL="${{ github.event.inputs.repo_url || github.repository }}"
CREATE_PR="${{ github.event.inputs.create_pr || 'false' }}"
CMD="python scripts/automate_full_pipeline.py --repo-url https://github.com/${REPO_URL}"
if [ "$CREATE_PR" = "true" ]; then
CMD="$CMD --create-pr"
fi
if [ -n "${{ github.event.inputs.issue_number }}" ]; then
# Run on specific issue
python scripts/run_e2e.py --repo "https://github.com/${REPO_URL}" --issue ${{ github.event.inputs.issue_number }}
else
# Run full automation
$CMD
fi
- name: Upload Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: openfix-results
path: |
openfix/artifacts/
openfix/data/patches/
openfix/data/runs/
retention-days: 30
- name: Read Confidence Report
if: success()
id: report
run: |
cd openfix
if [ -f artifacts/final_report.json ]; then
CONFIDENCE=$(jq -r '.confidence.confidence_score' artifacts/final_report.json)
RISK=$(jq -r '.confidence.risk_rating' artifacts/final_report.json)
RECOMMENDATION=$(jq -r '.summary.recommendation' artifacts/final_report.json)
echo "confidence=${CONFIDENCE}" >> $GITHUB_OUTPUT
echo "risk=${RISK}" >> $GITHUB_OUTPUT
echo "recommendation=${RECOMMENDATION}" >> $GITHUB_OUTPUT
fi
- name: Comment on PR with Confidence Assessment
if: github.event_name == 'pull_request' && success()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const confidence = '${{ steps.report.outputs.confidence }}';
const risk = '${{ steps.report.outputs.risk }}';
const recommendation = '${{ steps.report.outputs.recommendation }}';
const comment = `## 🤖 OpenFix Confidence Assessment
- **Confidence Score**: ${confidence}/100
- **Risk Rating**: ${risk}
**Recommendation**: ${recommendation}
*This assessment was generated by [OpenFix AI](https://github.com/${context.repo.owner}/openfix)*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
- name: Notify on Failure
if: failure()
run: |
echo "::error::OpenFix automation failed. Check logs for details."