Skip to main content
Article
github-copilot-workspaceissue-to-prai-code-generationdeveloper-toolsgithubtask-automationtechnical-preview

Go from GitHub Issue to PR with Copilot Workspace

Use GitHub Copilot Workspace to automate development from a task description. Start with a GitHub issue, let the agent generate a plan and code, then review the changes and create a pull request directly from the AI-native environment.

beginner30 min5 steps
The play
  1. Get Access & Select an Issue
    GitHub Copilot Workspace is in technical preview. Join the waitlist from the official project page. Once you have access, navigate to a repository you own and select or create a well-defined issue, such as a bug fix or a small feature request.
  2. Launch Workspace & Generate a Plan
    From the GitHub issue page, click the 'Open in Copilot Workspace' button (or modify the URL to 'github.com/.../issues/[issue_number]/workspace'). GitHub Copilot Workspace will analyze the issue and generate a step-by-step implementation plan.
  3. Review and Refine the Plan
    Critically review the proposed plan. This is your chance to guide the AI. Add, remove, or edit steps to ensure the approach is correct before any code is written. A clear plan leads to better implementation.
  4. Implement and Validate Changes
    Click 'Implement' to have GitHub Copilot Workspace generate the code based on the plan. It will edit multiple files as needed. Review the generated diffs. Use the integrated terminal to run builds, linters, or tests to validate the changes.
  5. Iterate or Create a Pull Request
    If the code isn't perfect, you can provide feedback in natural language (e.g., 'add a docstring to the new function') to iterate on the changes. Once you are satisfied, click 'Create pull request' to share your work with your team.
Starter code
# Prerequisite: Install and authenticate the GitHub CLI: `gh auth login`
# 1. Set your GitHub username and a repository name
GITHUB_USER="your-github-username"
REPO_NAME="copilot-workspace-starter"

# 2. Create a local project with a bug
mkdir $REPO_NAME && cd $REPO_NAME
echo """def add(a, b):
    # This function is supposed to add, but it subtracts
    return a - b

print(f'2 + 3 = {add(2, 3)}') # Expected: 5, Actual: -1""" > main.py

# 3. Initialize git and create the repo on GitHub
git init -b main
git add . && git commit -m "Initial commit with a bug"
gh repo create $GITHUB_USER/$REPO_NAME --public --source=.

# 4. Push the code to the new repository
git push -u origin main

# 5. Create an issue describing the bug
ISSUE_URL=$(gh issue create --title "Bug in add function" --body "The 'add' function in main.py is incorrectly subtracting numbers instead of adding them. It should be fixed to perform addition.")

# 6. Get the URL to open directly in Copilot Workspace
WORKSPACE_URL=$(echo $ISSUE_URL | sed 's|/issues/|/issues/1/workspace|')

echo "✅ Repo and issue created successfully!"
echo "➡️ Open in Copilot Workspace: $WORKSPACE_URL"
Go from GitHub Issue to PR with Copilot Workspace — Action Pack