This guide demonstrates how to use the Ona agent to autonomously complete GitHub issues in your Gitpod environment. The Ona agent can take on GitHub issues, create subtasks, break down complex problems, provide status updates, and ultimately complete tasks autonomously in its own secure development environment.

Caption: Video showing Ona creating breaking down an issue in GitHub into sub issues and completing it using the GitHub CLI.

Prerequisites

Before you can use Ona to autonomously complete GitHub issues, you’ll need to set up your development environment with the necessary tools and authentication.

1. Update your Dev Container with GitHub CLI

First, you’ll need to add the GitHub CLI feature to your dev container configuration. Add the following to your .devcontainer/devcontainer.json or .devcontainer.json file:

{
  "features": {
    "ghcr.io/devcontainers/features/github-cli:1": {}
  }
}

2. Rebuild your container

After updating your dev container configuration, you need to rebuild your container to apply the changes. You can do this in several ways:

Option A: Using VS Code Command Palette

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
  2. Search for and select Gitpod: Rebuild Container

Option B: Using the rebuild prompt

VS Code will automatically detect changes to your dev container configuration and show a rebuild prompt notification.

Option C: Using the Gitpod CLI

From your terminal, run:

gitpod environment devcontainer rebuild

While the container is rebuilding, you will be disconnected and automatically reconnected when it’s finished. You can inspect the details view to monitor progress and check logs.

3. Configure GitHub authentication

Once your container is rebuilt with the GitHub CLI installed, you need to set up authentication.

Option A: Using existing GitHub App permissions

If your GitHub app already has the necessary permissions, you can reuse the existing GitHub token that Gitpod provides automatically.

Option B: Adding a Personal Access Token (PAT)

If you need additional permissions or want to use a personal access token:

  1. Navigate to Settings > Secrets in your Gitpod dashboard
  2. Create a new user secret with the name GITHUB_TOKEN
  3. Add your GitHub personal access token as the value

4. Update your setup script

Create or update a setup script that runs when your dev container starts to authenticate with the GitHub CLI using the --with-token flag:

#!/bin/bash
# .devcontainer/setup.sh or similar startup script

# Authenticate with GitHub CLI using token
echo $GITHUB_TOKEN | gh auth login --with-token

# Verify authentication
gh auth status

Make sure to reference this script in your dev container configuration:

{
  "postCreateCommand": "bash .devcontainer/setup.sh"
}

Example prompts

Basic issue completion (without subtasks)

Using GitHub CLI, find and complete the first available issue in the repository. Create a working solution but do not commit or push your changes. Once the task is complete, mark the issue as ready for review.

Advanced issue management (with subtasks and updates)

Using GitHub CLI, find and complete the first available issue in the repository. Break down the main issue into smaller sub-issues or tasks using `gh issue create`, and update the main issue with `gh issue comment` to link to these sub-issues. As you progress through each subtask, systematically close them using `gh issue close` and add progress comments to the main issue using `gh issue comment`. Create a working solution but do not commit or push your changes to the main branch. Once all sub-tasks are complete and the main task is finished, mark the issue as ready for review using `gh issue edit` to add appropriate labels.