This is a starter template for building your own GitHub Copilot Extension. It's based on the blackbeard-extension example, modified to include deployment infrastructure and setup instructions.
Note:
Copilot Extensions are in public preview and may be subject to change.
All enrolled users with a GitHub Copilot Individual subscription can use Copilot Extensions. For organizations and enterprises with a Copilot Business or Copilot Enterprise subscription, organization owners and enterprise administrators can grant access to Copilot Extensions for use within their company.
Install dependencies:
npm install
To run locally:
npm start
or in watch mode:
npm run dev
- Create a
terraform.tfvars
file in theterraform
directory with the following content:
subscription_id = "your-azure-subscription-id"
github_repo = "your-github-username/your-repo-name"
- Initialize and apply the Terraform configuration:
cd terraform
terraform init
terraform plan -out tfplan.tfplan
terraform apply tfplan.tfplan
- After successful deployment, Terraform will output several values needed for the next steps. Add these values as GitHub repository secrets (Settings -> Secrets and variables -> Actions):
AZURE_CLIENT_ID
: The client ID of the managed identityAZURE_SUBSCRIPTION_ID
: Your Azure subscription IDAZURE_TENANT_ID
: Your Azure tenant IDACR_LOGIN_SERVER
: Your ACR login server URLACR_NAME
: The name of your Azure Container RegistryRESOURCE_GROUP_NAME
: The name of your Resource GroupCONTAINER_APP_NAME
: The name of your Container AppCONTAINER_APP_ENVIRONMENT
: The name of your Container App Environment
Note: The managed identity and federated credentials are automatically set up by Terraform, so there's no need to create a service principal manually.
-
Go to your GitHub account settings -> Developer Settings -> GitHub Apps
-
Click "New GitHub App"
-
Fill in the required fields:
- GitHub App name: Choose a unique name
- Homepage URL: Your repository URL
- Webhook:
- Active: Uncheck this box
- Webhook URL: Leave empty
- Callback URL: The Container App URL from Terraform output (e.g., https://your-app-name.region.azurecontainerapps.io)
- Expire user authorization tokens: Check this box
- Request user authorization (OAuth) during installation: Check this box
- Enable Device Flow: Leave unchecked
-
Set Account Permissions:
- GitHub Copilot Chat: Read-only
-
In the left sidebar, click Copilot:
- Read the GitHub Marketplace Developer Agreement and the GitHub Pre-release License Terms, then accept the terms for creating a Copilot Extension
- In the "App type" section, select the dropdown menu, then click Agent
- Under "URL," enter the Container App URL from Terraform output
- Under "Inference description", type a brief description of your agent, then click Save. This will be the description users see when they hover over your extension's slug in the chat window.
-
Install the app:
- Go to the "Install App" tab
- Choose the account where you want to install it
- Select the repositories you want the extension to have access to
After deployment and configuration:
- The GitHub Action will automatically build and deploy your extension
- Users can access your extension through GitHub Copilot Chat once installed
Using the GitHub Copilot Exptension in Visual Studio Code:
Using the GitHub Copilot Exptension on GitHub.com:
Checking the Azure Container Logs to confirm the extension is working: