Skip to content

Commit

Permalink
feat(resolver): implement gitlab resolver (#6458)
Browse files Browse the repository at this point in the history
Signed-off-by: José Luis Di Biase <[email protected]>
Co-authored-by: José Luis Di Biase <[email protected]>
Co-authored-by: Oriana <[email protected]>
Co-authored-by: Charlie <[email protected]>
Co-authored-by: Juan Manuel Daza <[email protected]>
Co-authored-by: Juan Manuel Daza <[email protected]>
Co-authored-by: Cody Kociemba <[email protected]>
Co-authored-by: Rohit Malhotra <[email protected]>
Co-authored-by: Engel Nyst <[email protected]>
  • Loading branch information
9 people authored Feb 13, 2025
1 parent ef12bc5 commit f5fccab
Show file tree
Hide file tree
Showing 29 changed files with 6,685 additions and 1,298 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/openhands-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
- name: Attempt to resolve issue
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }}
GITHUB_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
GIT_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
if: always() # Create PR or branch even if the previous steps fail
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }}
GITHUB_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
GIT_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
Expand Down
3 changes: 3 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export default defineConfig(({ mode }) => {
// rewriteWsOrigin: true,
},
},
watch: {
ignored: ['**/node_modules/**', '**/.git/**'],
},
},
ssr: {
noExternal: ["react-syntax-highlighter"],
Expand Down
41 changes: 28 additions & 13 deletions openhands/resolver/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OpenHands Github Issue Resolver 🙌
# OpenHands Github & Gitlab Issue Resolver 🙌

Need help resolving a GitHub issue but don't have the time to do it yourself? Let an AI agent help you out!

Expand Down Expand Up @@ -74,14 +74,24 @@ If you prefer to run the resolver programmatically instead of using GitHub Actio
pip install openhands-ai
```

2. Create a GitHub access token:
- Visit [GitHub's token settings](https://github.com/settings/personal-access-tokens/new)
- Create a fine-grained token with these scopes:
- "Content"
- "Pull requests"
- "Issues"
- "Workflows"
- If you don't have push access to the target repo, you can fork it first
2. Create a GitHub or GitLab access token:
- Create a GitHub acces token
- Visit [GitHub's token settings](https://github.com/settings/personal-access-tokens/new)
- Create a fine-grained token with these scopes:
- "Content"
- "Pull requests"
- "Issues"
- "Workflows"
- If you don't have push access to the target repo, you can fork it first

- Create a GitLab acces token
- Visit [GitLab's token settings](https://gitlab.com/-/user_settings/personal_access_tokens)
- Create a fine-grained token with these scopes:
- 'api'
- 'read_api'
- 'read_user'
- 'read_repository'
- 'write_repository'

3. Set up environment variables:

Expand All @@ -90,7 +100,12 @@ pip install openhands-ai
# GitHub credentials

export GITHUB_TOKEN="your-github-token"
export GITHUB_USERNAME="your-github-username" # Optional, defaults to token owner
export GIT_USERNAME="your-github-username" # Optional, defaults to token owner

# GitLab credentials if you're using GitLab repo

export GITLAB_TOKEN="your-gitlab-token"
export GIT_USERNAME="your-gitlab-username" # Optional, defaults to token owner

# LLM configuration

Expand Down Expand Up @@ -169,13 +184,13 @@ There are three ways you can upload:
3. `ready` - create a non-draft PR that's ready for review

```bash
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --github-username YOUR_GITHUB_USERNAME --pr-type draft
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --username YOUR_GITHUB_OR_GITLAB_USERNAME --pr-type draft
```

If you want to upload to a fork, you can do so by specifying the `fork-owner`:

```bash
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --github-username YOUR_GITHUB_USERNAME --pr-type draft --fork-owner YOUR_GITHUB_USERNAME
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --username YOUR_GITHUB_OR_GITLAB_USERNAME --pr-type draft --fork-owner YOUR_GITHUB_OR_GITLAB_USERNAME
```

## Providing Custom Instructions
Expand All @@ -184,5 +199,5 @@ You can customize how the AI agent approaches issue resolution by adding a `.ope

## Troubleshooting

If you have any issues, please open an issue on this github repo, we're happy to help!
If you have any issues, please open an issue on this github or gitlab repo, we're happy to help!
Alternatively, you can [email us](mailto:[email protected]) or join the OpenHands Slack workspace (see [the README](/README.md) for an invite link).
21 changes: 0 additions & 21 deletions openhands/resolver/github_issue.py

This file was deleted.

Loading

0 comments on commit f5fccab

Please sign in to comment.