Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: labudis <2659733+labudis@users.noreply.github.com> Co-authored-by: Tadas Labudis <labudis@github.com> Co-authored-by: Lukasz Warchol <lukewar@github.com> Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Tim Rogers <timrogers@github.com> Co-authored-by: hubwriter <hubwriter@github.com>
14 KiB
title, shortTitle, intro, product, versions, topics, redirect_from, contentType
| title | shortTitle | intro | product | versions | topics | redirect_from | contentType | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Using GitHub Copilot to work on an issue | Assign Copilot to an issue | Learn how to assign issues to {% data variables.product.prodname_copilot %}, monitor progress as {% data variables.product.prodname_copilot_short %} works on the issue, and then use pull request review comments to prompt {% data variables.product.prodname_copilot_short %} to iterate on its work. | {% data reusables.gated-features.copilot-coding-agent %}<br><a href="https://github.com/features/copilot/plans?ref_cta=Copilot+plans+signup&ref_loc=using+copilot+to+work+on+an+issue&ref_page=docs" target="_blank" class="btn btn-primary mt-3 mr-3 no-underline"><span>Sign up for {% data variables.product.prodname_copilot_short %}</span> {% octicon "link-external" height:16 %}</a> |
|
|
|
how-tos |
Note
{% data reusables.copilot.coding-agent.preview-note-text %} For an overview of {% data variables.copilot.copilot_coding_agent %}, see AUTOTITLE.
Introduction
You can assign a {% data variables.product.github %} issue to {% data variables.product.prodname_copilot_short %}, just like you would with a human software developer. When assigning an issue, you can pick the repository where {% data variables.product.prodname_copilot_short %} should make code changes and the branch it should start from. {% data variables.product.prodname_copilot_short %} will start working on the issue, create a draft pull request and, when it's finished working, it will request a review from you. For more information, see AUTOTITLE.
If you haven't used {% data variables.product.prodname_copilot_short %} to work on an issue before, you can find some useful advice for getting good results in AUTOTITLE.
Assigning an issue to {% data variables.product.prodname_copilot_short %}
You can ask {% data variables.product.prodname_copilot_short %} to start working on an issue by assigning the issue to {% data variables.product.prodname_copilot_short %}.
You can assign an issue to {% data variables.product.prodname_copilot_short %}:
- On {% data variables.product.prodname_dotcom_the_website %} (see the next section)
- On {% data variables.product.prodname_mobile %}
- Via the {% data variables.product.github %} API (see later in this article)
- Using {% data variables.product.prodname_cli %} (see
gh issue edit)
Assigning an issue to {% data variables.product.prodname_copilot_short %} on {% data variables.product.prodname_dotcom_the_website %}
You can assign an issue to {% data variables.product.prodname_copilot_short %} on {% data variables.product.prodname_dotcom_the_website %} in exactly the same way as you assign another user.
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-issues %}
-
Open the issue that you want to assign to {% data variables.product.prodname_copilot_short %}.
-
In the right side menu, click Assignees.
-
Click Copilot from assignees list.
Additional options are displayed.
-
In the Optional prompt field you can add specific guidance for {% data variables.product.prodname_copilot_short %}. Add any context, constraints, or specific requirements that will help {% data variables.product.prodname_copilot_short %} to understand and complete the task.
For example, you might include instructions about specific coding patterns or frameworks to use, testing requirements, code style preferences, files or directories that should or shouldn't be modified.
In addition to the details you supply here, {% data variables.product.prodname_copilot_short %} will use any custom instructions that have been configured for the target repository. See AUTOTITLE.
-
You can use the dropdown menus in the dialog to change the repository that {% data variables.product.prodname_copilot_short %} will work in and the branch that it will branch off from.
Note
If you don't specify a repository, {% data variables.product.prodname_copilot_short %} will work in the same repository as the issue. If you don't specify a branch, {% data variables.product.prodname_copilot_short %} will work from the default branch of the selected repository.
Tip
When you assign an issue to {% data variables.product.prodname_copilot_short %}, it gets sent the issue title, description, any comments that currently exist, and any additional instructions you provide. After assigning the issue, {% data variables.product.prodname_copilot_short %} will not be aware of, and therefore won't react to, any further comments that are added to the issue. If you have more information, or changes to the original requirement, add this as a comment in the pull request that {% data variables.product.prodname_copilot_short %} raises.
You can also assign issues to {% data variables.product.prodname_copilot_short %} from other places on {% data variables.product.prodname_dotcom_the_website %}:
- From the list of issues on a repository's {% octicon "issue-opened" aria-hidden="true" aria-label="issue-opened" %} Issues page.
- When viewing an issue in {% data variables.product.github %} {% data variables.projects.projects_v2_caps %}.
Assigning an issue to {% data variables.product.prodname_copilot_short %} via the {% data variables.product.github %} API
You can assign issues to {% data variables.product.prodname_copilot_short %} using the GraphQL API.
Creating and assigning a new issue
-
Make sure you're authenticating with the API using a user token, for example a {% data variables.product.pat_generic %} or a {% data variables.product.prodname_github_app %} user-to-server token.
-
Verify that {% data variables.copilot.copilot_coding_agent %} is enabled in the repository by checking if the repository's
suggestedActorsin the GraphQL API includes {% data variables.product.prodname_copilot_short %}. Replaceocto-orgwith the repository owner, andocto-repowith the repository name.query { repository(owner: "octo-org", name: "octo-repo") { suggestedActors(capabilities: [CAN_BE_ASSIGNED], first: 100) { nodes { login __typename ... on Bot { id } ... on User { id } } } } }If {% data variables.copilot.copilot_coding_agent %} is enabled for the user and in the repository, the first node returned from the query will have the
loginvaluecopilot-swe-agent. -
Make a note of the
idvalue of this login. -
Fetch the GraphQL global ID of the repository you want to create the issue in, replacing
octo-orgwith the repository owner, andocto-repowith the repository name.query { repository(owner: "octo-org", name: "octo-repo") { id } } -
Create the issue with the
createIssuemutation. ReplaceREPOSITORY_IDwith the ID returned from the previous step, andBOT_IDwith the ID returned from the step before that.mutation { createIssue(input: {repositoryId: "REPOSITORY_ID", title: "Implement comprehensive unit tests", body: "DETAILS", assigneeIds: ["BOT_ID"]}) { issue { id title assignees(first: 10) { nodes { login } } } } }
Assigning an existing issue
-
Make sure you're authenticating with the API using a user token, for example a {% data variables.product.pat_generic %} or a {% data variables.product.prodname_github_app %} user-to-server token.
-
Verify that {% data variables.copilot.copilot_coding_agent %} is enabled in the repository by checking if the repository's
suggestedActorsin the GraphQL API includes {% data variables.product.prodname_copilot_short %}. Replaceocto-orgwith the repository owner, andocto-repowith the repository name.query { repository(owner: "monalisa", name: "octocat") { suggestedActors(capabilities: [CAN_BE_ASSIGNED], first: 100) { nodes { login __typename ... on Bot { id } ... on User { id } } } } }If {% data variables.copilot.copilot_coding_agent %} is enabled for the user and in the repository, the first node returned from the query will have the
loginvaluecopilot-swe-agent. -
Fetch the GraphQL global ID of the issue you want to assign to {% data variables.product.prodname_copilot_short %}, replacing
monalisawith the repository owner,octocatwith the name and9000with the issue number.query { repository(owner: "monalisa", name: "octocat") { issue(number: 9000) { id title } } } -
Assign the existing issue to {% data variables.product.prodname_copilot_short %} using the
replaceActorsForAssignablemutation. ReplaceISSUE_IDwith the ID returned from the previous step, andBOT_IDwith the ID returned from the step before that.mutation { replaceActorsForAssignable(input: {assignableId: "ISSUE_ID", actorIds: ["BOT_ID"]}) { assignable { ... on Issue { id title assignees(first: 10) { nodes { login } } } } } }
Tracking {% data variables.product.prodname_copilot_short %}'s progress on your issue
Shortly after you assign an issue to {% data variables.product.prodname_copilot_short %}, {% data variables.product.prodname_copilot_short %} will leave an 👀 reaction on the issue.
A few seconds later, {% data variables.product.prodname_copilot_short %} will open a draft pull request, linked to your original issue. An event will appear in the issue's timeline, linking to the pull request.
{% data variables.product.prodname_copilot_short %} will start an agent session to work on your issue. A "{% data variables.product.prodname_copilot_short %} started work" event will appear in the pull request timeline, and as {% data variables.product.prodname_copilot_short %} works, it will update the pull request body with regular status updates, and push commits to the branch.
All of your sessions, past and present, can be seen and tracked from the Agents page. See AUTOTITLE.
If you want to check what {% data variables.product.prodname_copilot_short %} is doing, click View session. The session log viewer is displayed, showing you a live log as {% data variables.product.prodname_copilot_short %} works on the issue. If you want to stop {% data variables.product.prodname_copilot_short %} from working on the issue, click Stop session. See AUTOTITLE.
Once {% data variables.product.prodname_copilot_short %} has finished, the agent session will end, and {% data variables.product.prodname_copilot_short %} will request a review from you, triggering a notification. In addition, a "{% data variables.product.prodname_copilot_short %} finished work" event will appear in the pull request timeline.
Working with {% data variables.product.prodname_copilot_short %} on a pull request
After {% data variables.product.prodname_copilot_short %} has finished working on the issue, you should review the pull request thoroughly and mention @copilot in a comment if anything needs to be changed. See AUTOTITLE.






