In this lab, you'll create a GitHub Copilot Extension by setting up a GitHub App. This app will serve as the foundation for integrating with GitHub Copilot.
Follow the steps below to configure your app and connect it to your Codespace environment.
Watch the Walkthrough video or follow the steps below to complete the lab.
Before you start, ensure you have:
-
Port Forwarded: Ensure that you have made your application port (3000) publically accessible from your codespace.
-
Started the Agent: Ensure that you have started the agent in your codespace. You can do this by running the following command in your codespace terminal:
npm run dev
-
Agent API URL: You can find this from your ports tab in your codespace. It will be in the format
https://<your-codespace-name>-3000.githubpreview.dev/
Now, let's create your GitHub App:
-
Sign in to GitHub and click on your profile photo in the upper-right corner of any page.
-
Navigate to Account Settings:
- We will create an app owned by a personal account, to do that click on Settings.
- It is possible to create an organization app, but we will not be doing this in the workshop.
-
In the left sidebar, click on Developer settings.
-
Then, click on GitHub Apps.
-
Click on New GitHub App.
-
Under GitHub App name, enter a name for your app. Note:
- The name cannot exceed 34 characters.
- The name will be displayed in lowercase, with spaces replaced by hyphens, and accents ignored. For example, "My App Name” would display as “my-app-name”.
- Ensure the name is unique across GitHub and not already in use by another account.
- example
copilot-workshop-<YOUR-GITHUB-HANDLE>
- example
-
Optionally, provide a description of your app under Description. This description will be visible to users and organizations when they install your app.
-
Under Homepage URL, enter a URL for your app. You can use:
- Enter any URL here for the workshop e.g.
https://mycopilotextension.com
.
- Enter any URL here for the workshop e.g.
-
Under Callback URL, enter the URL from codespaces. It will be in the format
https://<your-codespace-name>-3000.githubpreview.dev/
. This is the local address from Lab 1.1 step 5. -
Under Webhook, deselect Active.
-
Set Permissions:
- In the left sidebar, click on Permissions & events.
- Click to expand the Account permissions section.
- In the GitHub Copilot Chat row, select Access from the dropdown menu, then choose Read-only. Click Save changes.
- Click on Create GitHub App.
- Complete Copilot Settings:
- In the left sidebar, click on Copilot.
- In the App type section, select the dropdown menu and click Agent.
- Under URL, enter the url from codespaces (the same you used in the "callback" field).
- Under Inference description, type a brief description of your agent, then click Save. This description will be visible to users when they hover over your agent's slug in the chat window.
- Using Your Extension:
- On any page on GitHub.com, click the GitHub Copilot icon at the bottom right of the page. The GitHub Copilot Chat panel will display.
- To resize the panel, click and drag the top or left edge.
- If the panel contains a previous conversation, click the New conversation icon (a plus sign) at the top right of the panel.
- Invoke Your Extension:
- Type @EXTENSION-NAME, replacing any spaces in the extension name with hyphens, then press Enter (be mindful that, for a new extension, it may take some time to have the name auto-completed, thus try typing the full name on the first times you invoke your extension).
- Connect:
- If this is your first time using the extension, you will be prompted to connect the app.
- Authorize:
- After connecting, you will be prompted to authorize the app.
- Development Port:
- If detected you may be prompted to authorize your agent to communicate over the development port of codespaces.
- Ask Your Extension a Question:
- Once authenticated, you can start interacting with your extension. For example, ask: "What is the software development lifecycle?"
Some other examples you could try:
Add an apple to the shopping list
Add 5 oranges to the list
What's on the list?
How can you help me?
With your GitHub App now configured and ready, you can proceed to the next lab, where you will start building out the core functionality for your extension.
Continue to Lab 2.0 - Understanding the Logic
Also see - GitHub Docs - Creating a GitHub App for Your Copilot Extension