Breyta

Deila með


Quickstart: create and apply your own tasks for GitHub Copilot app modernization

This quickstart shows you how to create and apply your own tasks when you use GitHub Copilot app modernization.

In code development, enterprises often have different processes and controls to adhere to their organizational policies and business needs. This area is where My Tasks (Custom) come in. Your own task is generated by analyzing code commits from already-migrated code. The task then guides Copilot to remediate code, following the pattern established by the already-migrated code.

The following video demonstrates using GitHub Copilot app modernization to create and apply your own custom task to migrate a Java project to Azure:


Prerequisites

Note

If you're using Gradle, only the Gradle wrapper version 5+ is supported. The Kotlin Domain Specific Language (DSL) isn't supported.

The function My Tasks isn't supported yet for IntelliJ IDEA.

Create your own task

We now support three ways to add references: Git commits, external links, and text files. You can use one or more methods at a time.

Use Git commits

The following steps provide an example of creating your own task by using Git commits as references:

  1. Clone the Java migration copilot samples repository.

  2. In Visual Studio Code, open the rabbitmq-sender project folder from the cloned repository. Then, switch to the source branch.

  3. In the Activity sidebar, open the GitHub Copilot app modernization extension pane, hover over the TASKS section, and then select Create a Custom Task.

    Screenshot of Visual Studio Code that shows the GitHub Copilot app modernization Tasks pane with the Create a Custom Task button highlighted.

  4. A task.md file opens. In the Task Name field, enter Custom task migrate rabbitmq. In the Task Prompt field, enter You are a Spring Boot developer assistant, follow the commit to migrate from rabbitmq to servicebus.

    Screenshot of Visual Studio Code that shows the migrate rabbitmq task with the Task Name and Task Prompt fields highlighted.

  5. Select Add References and then select Git commits in the pop-up dialog box.

    Screenshot of Visual Studio Code that shows the Select source type drop-down list with the Git commits option highlighted.

  6. Search for the commit that migrates RabbitMQ by typing migrate rabbitmq to service bus. Select the corresponding commit and then select OK.

    Screenshot of the Visual Studio Code dialog box with the heading Select commits as sources.

  7. Select Save. Your custom task for migrating rabbitmq now appears in the TASKS - My Tasks section.

    Screenshot of Visual Studio Code that shows the task.md file with the Save button highlighted.

The following steps show an example of creating your own task by using external links and text files as references:

  1. Open the task.md file by following the predefined steps in the GitHub Copilot app modernization extension.

  2. In the opened task.md file, enter the following information:

    • Task Name: Expose health endpoint via Spring Boot Actuator.
    • Task Prompt: You are a Spring Boot developer assistant, follow the Spring Boot Actuator documentation to add basic health endpoints for Azure Container Apps deployment.

    Screenshot of Visual Studio Code that shows the expose health endpoint task with the Task Name and Task Prompt fields highlighted.

  3. Select Add References. In the pop-up window, select External links, then paste the following URL: https://docs.spring.io/spring-boot/reference/actuator/endpoints.html and press Enter to confirm.

    Screenshot of Visual Studio Code that shows the task.md file with the external link field highlighted.

  4. Create a file containing the following content:

    In this migration, only expose the health endpoints over web, use the following property:
    management.endpoints.web.exposure.include=health
    
  5. Select Add References again, and this time select Text Files. Locate the file you created and then select Select File.

  6. You should now see two references added: one external link and one text file. Select Save to finalize and create the task.

    Screenshot of Visual Studio Code that shows the task.md file with the Name column highlighted, which contains the references added.

Share your own task

Use the following steps to share your task with others:

  1. Copy the folder located under .github/appmod/custom-tasks that contains your created task, and share it with the intended recipient.

    Screenshot of Visual Studio Code that shows copy a custom folder.

  2. On the recipient's side, create a .github/appmod/custom-tasks directory within the source path of their project.

    Screenshot of Visual Studio Code that shows create a custom folder.

  3. Paste the task folder into this directory and then select Refresh Task in the extension pane.

    Screenshot of Visual Studio Code that shows refresh task.

  4. The task now appears in the TASKS - My Tasks section, ready to be used.

    Screenshot of Visual Studio Code that shows refreshed task.

Apply your own task

Use the following steps to apply your own task:

  1. Select Run at the bottom of the file. Or find your own task in the TASKS - My Tasks section of GitHub Copilot app modernization pane and run the task by selecting Run Task.

    Screenshot of Visual Studio Code that shows the Tasks section with the Run task and Run button highlighted.

  2. The Copilot chat window opens in Agent Mode and automatically executes the following steps:

    • Creates plan.md and progress.md.
    • Checks the version control status and checks out a new migration branch.
    • Performs code migration.
    • Runs validations: Build, Tests, CVE, Consistency, and Completeness.
    • Generates a summary.md file.
  3. If the agent stops while waiting for your confirmation or is interrupted during execution, enter Continue to proceed.

  4. After all steps finished, review the code changes and then select Keep to confirm in chat window.

Update or delete your own task

Locate the Custom task migrate rabbitmq in the TASKS - My Tasks section and then right-click to open the context menu and choose one of the following options:

  • Edit to update the task.
  • Delete to remove the task.

Screenshot of Visual Studio Code that shows edit or delete custom task.

Next step

Predefined tasks for GitHub Copilot app modernization