forked from soumyajit4419/Portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ec9303
commit 29e9321
Showing
9 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: Auto-Fix Tagged Issues with OpenHands | ||
|
||
on: | ||
issues: | ||
types: [labeled] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
issues: write | ||
|
||
jobs: | ||
auto-fix: | ||
if: github.event.label.name == 'fix-me-twomodel' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Parse and Select Models | ||
id: select_models | ||
run: | | ||
MODELS=($(echo ${{ secrets.MODEL_LIST }} | jq -r '.[]')) | ||
API_KEYS=($(echo ${{ secrets.API_KEY_LIST }} | jq -r '.[]')) | ||
# Select two random indices | ||
SELECTED_INDICES=($(shuf -i 0-$((${#MODELS[@]}-1)) -n 2)) | ||
# Export selected models and API keys | ||
SELECTED_MODEL_1=${MODELS[${SELECTED_INDICES[0]}]} | ||
SELECTED_API_KEY_1=${API_KEYS[${SELECTED_INDICES[0]}]} | ||
SELECTED_MODEL_2=${MODELS[${SELECTED_INDICES[1]}]} | ||
SELECTED_API_KEY_2=${API_KEYS[${SELECTED_INDICES[1]}]} | ||
echo "MODEL_1=$SELECTED_MODEL_1" >> $GITHUB_ENV | ||
echo "API_KEY_1=$SELECTED_API_KEY_1" >> $GITHUB_ENV | ||
echo "MODEL_2=$SELECTED_MODEL_2" >> $GITHUB_ENV | ||
echo "API_KEY_2=$SELECTED_API_KEY_2" >> $GITHUB_ENV | ||
- name: Set issue number | ||
run: echo "ISSUE_NUMBER=${{ github.event.issue.number }}" >> $GITHUB_ENV | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install openhands-resolver | ||
- name: Attempt to resolve issue with Model 1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
LLM_MODEL: ${{ env.MODEL_1 }} | ||
LLM_API_KEY: ${{ env.API_KEY_1 }} | ||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | ||
run: | | ||
cd /tmp && python -m openhands_resolver.resolve_issues \ | ||
--repo ${{ github.repository }} \ | ||
--issue-numbers ${{ env.ISSUE_NUMBER }} | ||
- name: Check resolution result for Model 1 | ||
id: check_result_model_1 | ||
run: | | ||
if cd /tmp && grep -q '"success":true' output/output.jsonl; then | ||
echo "RESOLUTION_SUCCESS_MODEL_1=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "RESOLUTION_SUCCESS_MODEL_1=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Create draft PR or push branch for Model 1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
LLM_MODEL: ${{ env.MODEL_1 }} | ||
LLM_API_KEY: ${{ env.API_KEY_1 }} | ||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | ||
run: | | ||
if [ "${{ steps.check_result_model_1.outputs.RESOLUTION_SUCCESS_MODEL_1 }}" == "true" ]; then | ||
cd /tmp && python -m openhands_resolver.send_pull_request \ | ||
--issue-number ${{ env.ISSUE_NUMBER }} \ | ||
--pr-type draft --pr-prefix ${{ env.MODEL_1 }} | tee pr_result_model_1.txt | ||
else | ||
cd /tmp && python -m openhands_resolver.send_pull_request \ | ||
--issue-number ${{ env.ISSUE_NUMBER }} \ | ||
--pr-type branch --branch-prefix ${{ env.MODEL_1 }} \ | ||
--send-on-failure | tee branch_result_model_1.txt | ||
fi | ||
- name: Attempt to resolve issue with Model 2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
LLM_MODEL: ${{ env.MODEL_2 }} | ||
LLM_API_KEY: ${{ env.API_KEY_2 }} | ||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | ||
run: | | ||
cd /tmp && python -m openhands_resolver.resolve_issues \ | ||
--repo ${{ github.repository }} \ | ||
--issue-numbers ${{ env.ISSUE_NUMBER }} | ||
- name: Check resolution result for Model 2 | ||
id: check_result_model_2 | ||
run: | | ||
if cd /tmp && grep -q '"success":true' output/output.jsonl; then | ||
echo "RESOLUTION_SUCCESS_MODEL_2=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "RESOLUTION_SUCCESS_MODEL_2=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Create draft PR or push branch for Model 2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
LLM_MODEL: ${{ env.MODEL_2 }} | ||
LLM_API_KEY: ${{ env.API_KEY_2 }} | ||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | ||
run: | | ||
if [ "${{ steps.check_result_model_2.outputs.RESOLUTION_SUCCESS_MODEL_2 }}" == "true" ]; then | ||
cd /tmp && python -m openhands_resolver.send_pull_request \ | ||
--issue-number ${{ env.ISSUE_NUMBER }} \ | ||
--pr-type draft --pr-prefix ${{ env.MODEL_2 }} | tee pr_result_model_2.txt | ||
else | ||
cd /tmp && python -m openhands_resolver.send_pull_request \ | ||
--issue-number ${{ env.ISSUE_NUMBER }} \ | ||
--pr-type branch --branch-prefix ${{ env.MODEL_2 }} \ | ||
--send-on-failure | tee branch_result_model_2.txt | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Submodule issue_1
added at
91481e
Submodule issue_4
added at
db440b
Submodule repo
added at
eb1dcb
Submodule issue_1
added at
eb1dcb
Submodule issue_3
added at
eb1dcb
Submodule issue_4
added at
eb1dcb