Skip to content

Commit

Permalink
add testtwo
Browse files Browse the repository at this point in the history
  • Loading branch information
aglassoforange committed Oct 28, 2024
1 parent 7ec9303 commit 29e9321
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 1 deletion.
127 changes: 127 additions & 0 deletions .github/workflows/openhands-resolver-testtwo.yml
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
2 changes: 1 addition & 1 deletion .github/workflows/openhands-resolver-twomodels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ permissions:

jobs:
auto-fix:
if: github.event_name == 'workflow_call' || github.event.label.name == 'fix-me'
if: github.event_name == 'workflow_call' || github.event.label.name == 'fix-me-twomodel'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
2 changes: 2 additions & 0 deletions output/output.jsonl

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions output/patches/issue_1
Submodule issue_1 added at 91481e
1 change: 1 addition & 0 deletions output/patches/issue_4
Submodule issue_4 added at db440b
1 change: 1 addition & 0 deletions output/repo
Submodule repo added at eb1dcb
1 change: 1 addition & 0 deletions output/workspace/issue_1
Submodule issue_1 added at eb1dcb
1 change: 1 addition & 0 deletions output/workspace/issue_3
Submodule issue_3 added at eb1dcb
1 change: 1 addition & 0 deletions output/workspace/issue_4
Submodule issue_4 added at eb1dcb

0 comments on commit 29e9321

Please sign in to comment.