When you're rolling out GitHub Copilot in a business, it's important to keep track of which users are using their Copilot license, so you can respond effectively by reassigning unused licenses or helping people to get started with Copilot.
You can use the List all Copilot seat assignments for an organization API endpoint to find the last activity date for each user who is assigned a license in an organization. Then, you can respond automatically by filtering for users who haven't used their license for a certain amount of time and sending a reminder to those users.
Writing the reminder message
Your reminder to inactive users should help users to get past common adoption blockers for Copilot. We recommend identifying specific blockers for your company by running surveys or interviewing developers.
For example, the message could include information and links to help users:
- Install Copilot in their environment.
- Set up Copilot to work with your company's proxy or firewall.
- Get the most out of Copilot in their day-to-day work.
You should also clearly communicate any further action you will take if the license continues to go unused, such as revoking the user's license.
Example reminder
In the next section, we'll use this message in an automation that creates an issue assigned to each inactive user.
We noticed you haven't used your assigned license for GitHub Copilot in 30 days. Here are some resources that might help you get started:
- If you haven't yet set up Copilot in your environment, see Setting up GitHub Copilot for yourself or Troubleshooting common issues with GitHub Copilot.
- For best practices and advice on getting started, see Best practices for using GitHub Copilot or Prompt engineering for GitHub Copilot.
- For examples related to specific tasks, see Copilot Chat Cookbook.
If you no longer need access to Copilot, please let us know in this issue. If your license remains inactive for a further 30 days, we'll revoke it to free up access for another user.
Example reminder in Markdown
We noticed you haven't used your assigned license for GitHub Copilot in 30 days. Here are some resources that might help you get started: * If you haven't yet set up Copilot in your environment, see [Setting up GitHub Copilot for yourself](https://docs.github.com/en/copilot/setting-up-github-copilot/setting-up-github-copilot-for-yourself) or [Troubleshooting common issues with GitHub Copilot](https://docs.github.com/en/copilot/troubleshooting-github-copilot/troubleshooting-common-issues-with-github-copilot). * For best practices and advice on getting started, see [Best practices for using GitHub Copilot](https://docs.github.com/en/copilot/using-github-copilot/best-practices-for-using-github-copilot) or [Prompt engineering for GitHub Copilot](https://docs.github.com/en/copilot/using-github-copilot/prompt-engineering-for-github-copilot). * For examples related to specific tasks, see [Copilot Chat Cookbook](https://docs.github.com/en/copilot/example-prompts-for-github-copilot-chat). If you no longer need access to Copilot, please let us know in this issue. If your license remains inactive for a further 30 days, we'll revoke it to free up access for another user.
We noticed you haven't used your assigned license for GitHub Copilot in 30 days. Here are some resources that might help you get started:
* If you haven't yet set up Copilot in your environment, see [Setting up GitHub Copilot for yourself](https://docs.github.com/en/copilot/setting-up-github-copilot/setting-up-github-copilot-for-yourself) or [Troubleshooting common issues with GitHub Copilot](https://docs.github.com/en/copilot/troubleshooting-github-copilot/troubleshooting-common-issues-with-github-copilot).
* For best practices and advice on getting started, see [Best practices for using GitHub Copilot](https://docs.github.com/en/copilot/using-github-copilot/best-practices-for-using-github-copilot) or [Prompt engineering for GitHub Copilot](https://docs.github.com/en/copilot/using-github-copilot/prompt-engineering-for-github-copilot).
* For examples related to specific tasks, see [Copilot Chat Cookbook](https://docs.github.com/en/copilot/example-prompts-for-github-copilot-chat).
If you no longer need access to Copilot, please let us know in this issue. If your license remains inactive for a further 30 days, we'll revoke it to free up access for another user.
Automating the reminder with GitHub Actions
The following example workflow uses the API to identify users in an organization who haven't used their license for 30 days, then creates an issue assigned to each user. This is a simple example that you can adapt to meet your needs.
To use this workflow:
-
Create a label in the repository where reminder issues will be created. Call the label
copilot-reminder
. We'll use this label to check whether a reminder issue is already open for each inactive user.To create a label, see Managing labels.
-
Save your reminder message, such as the one provided in Example reminder in Markdown, as an GitHub Actions variable in your repository or organization. Call the variable
COPILOT_REMINDER_MESSAGE
.To create a variable, see Store information in variables.
-
Create a personal access token with permission to call the List all Copilot seat assignments for an organization API endpoint. For example, create a fine-grained token with the following details:
- Resource owner: The organization where you're looking for inactive users.
- Organization permissions: GitHub Copilot Business (read-only).
To create a token, see Managing your personal access tokens.
-
Save the access token as a GitHub Actions secret in your repository or organization. Call the secret
COPILOT_LICENSE_READ
.To create a secret, see Using secrets in GitHub Actions.
-
Using the example below, create the workflow in the repository where you want the reminder issues to be created.
If you're new to GitHub Actions, see Quickstart for GitHub Actions.
-
In the workflow, replace the
ORG/REPO
placeholders in thegh
commands with the name of the repository where you want the reminder issues to be created. For example:octo-org/octo-repo
.
Example workflow
Note
This example assumes you assign licenses through an organization. If you use a dedicated enterprise account for Copilot Business, you will need to use different API endpoints. See Setting up a dedicated enterprise for Copilot Business (personal accounts).
# Name your workflow name: Remind inactive users about Copilot license # Run the workflow every day at 8am UTC on: schedule: - cron: '0 8 * * *' jobs: context-log: runs-on: ubuntu-latest steps: - name: Check Copilot Last Activity id: check-last-activity run: | # Call the user management API RESPONSE=$(gh api \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ -H "Authorization: Bearer ${{ secrets.COPILOT_LICENSE_READ }}" \ /orgs/$ORGANIZATION_VAR/copilot/billing/seats) echo "Raw Response from gh api:" echo "$RESPONSE" # Parse and check each user's `last_activity_at` echo "$RESPONSE" | jq -c '.seats[]' | while read -r seat; do LOGIN=$(echo "$seat" | jq -r '.assignee.login') LAST_ACTIVITY=$(echo "$seat" | jq -r '.last_activity_at') # Replace ORG/REPO with the repository name EXISTING_ISSUES=$(gh issue list --repo ORG/REPO --assignee $LOGIN --label 'copilot-reminder' --json id) # Convert dates to seconds since epoch for comparison LAST_ACTIVITY_DATE=$(date -d "$LAST_ACTIVITY" +%s) THIRTY_DAYS_AGO=$(date -d "30 days ago" +%s) # Create issues for inactive users who don't have an existing open issue if [ "$LAST_ACTIVITY_DATE" -lt "$THIRTY_DAYS_AGO" ] && [ "$EXISTING_ISSUES" = "[]" ]; then echo "User $LOGIN has not been active in the last 30 days. Last activity: $LAST_ACTIVITY" # Replace ORG/REPO with the repository name NEW_ISSUE_URL="$(gh issue create --title "Reminder about your GitHub Copilot license" --body "${{ vars.COPILOT_REMINDER_MESSAGE }}" --repo ORG/REPO --assignee $LOGIN --label 'copilot-reminder')" else echo "User $LOGIN is active or already has an assigned reminder issue. Last activity: $LAST_ACTIVITY" fi done # Set the GITHUB_TOKEN, required for the `gh issue` commands env: GITHUB_TOKEN: ${{ github.token }}
name: Remind inactive users about Copilot license
Name your workflow
on:
schedule:
- cron: '0 8 * * *'
jobs:
context-log:
runs-on: ubuntu-latest
steps:
- name: Check Copilot Last Activity
id: check-last-activity
run: |
Run the workflow every day at 8am UTC
RESPONSE=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer ${{ secrets.COPILOT_LICENSE_READ }}" \
/orgs/$ORGANIZATION_VAR/copilot/billing/seats)
echo "Raw Response from gh api:"
echo "$RESPONSE"
Call the user management API
echo "$RESPONSE" | jq -c '.seats[]' | while read -r seat; do
LOGIN=$(echo "$seat" | jq -r '.assignee.login')
LAST_ACTIVITY=$(echo "$seat" | jq -r '.last_activity_at')
Parse and check each user's last_activity_at
EXISTING_ISSUES=$(gh issue list --repo ORG/REPO --assignee $LOGIN --label 'copilot-reminder' --json id)
Replace ORG/REPO with the repository name
LAST_ACTIVITY_DATE=$(date -d "$LAST_ACTIVITY" +%s)
THIRTY_DAYS_AGO=$(date -d "30 days ago" +%s)
Convert dates to seconds since epoch for comparison
if [ "$LAST_ACTIVITY_DATE" -lt "$THIRTY_DAYS_AGO" ] && [ "$EXISTING_ISSUES" = "[]" ]; then
echo "User $LOGIN has not been active in the last 30 days. Last activity: $LAST_ACTIVITY"
Create issues for inactive users who don't have an existing open issue
NEW_ISSUE_URL="$(gh issue create --title "Reminder about your GitHub Copilot license" --body "${{ vars.COPILOT_REMINDER_MESSAGE }}" --repo ORG/REPO --assignee $LOGIN --label 'copilot-reminder')"
else
echo "User $LOGIN is active or already has an assigned reminder issue. Last activity: $LAST_ACTIVITY"
fi
done
Replace ORG/REPO with the repository name
env:
GITHUB_TOKEN: ${{ github.token }}
Set the GITHUB_TOKEN, required for the gh issue
commands
# Name your workflow
name: Remind inactive users about Copilot license
# Run the workflow every day at 8am UTC
on:
schedule:
- cron: '0 8 * * *'
jobs:
context-log:
runs-on: ubuntu-latest
steps:
- name: Check Copilot Last Activity
id: check-last-activity
run: |
# Call the user management API
RESPONSE=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer ${{ secrets.COPILOT_LICENSE_READ }}" \
/orgs/$ORGANIZATION_VAR/copilot/billing/seats)
echo "Raw Response from gh api:"
echo "$RESPONSE"
# Parse and check each user's `last_activity_at`
echo "$RESPONSE" | jq -c '.seats[]' | while read -r seat; do
LOGIN=$(echo "$seat" | jq -r '.assignee.login')
LAST_ACTIVITY=$(echo "$seat" | jq -r '.last_activity_at')
# Replace ORG/REPO with the repository name
EXISTING_ISSUES=$(gh issue list --repo ORG/REPO --assignee $LOGIN --label 'copilot-reminder' --json id)
# Convert dates to seconds since epoch for comparison
LAST_ACTIVITY_DATE=$(date -d "$LAST_ACTIVITY" +%s)
THIRTY_DAYS_AGO=$(date -d "30 days ago" +%s)
# Create issues for inactive users who don't have an existing open issue
if [ "$LAST_ACTIVITY_DATE" -lt "$THIRTY_DAYS_AGO" ] && [ "$EXISTING_ISSUES" = "[]" ]; then
echo "User $LOGIN has not been active in the last 30 days. Last activity: $LAST_ACTIVITY"
# Replace ORG/REPO with the repository name
NEW_ISSUE_URL="$(gh issue create --title "Reminder about your GitHub Copilot license" --body "${{ vars.COPILOT_REMINDER_MESSAGE }}" --repo ORG/REPO --assignee $LOGIN --label 'copilot-reminder')"
else
echo "User $LOGIN is active or already has an assigned reminder issue. Last activity: $LAST_ACTIVITY"
fi
done
# Set the GITHUB_TOKEN, required for the `gh issue` commands
env:
GITHUB_TOKEN: ${{ github.token }}