Al implementar GitHub Copilot en una empresa, es importante hacer un seguimiento de qué usuarios usan su licencia de Copilot, para que puedas reaccionar de forma eficaz mediante la reasignación de licencias no usadas o ayudar a los usuarios a empezar a trabajar con Copilot.
Puedes usar el punto de conexión de API List all Copilot seat assignments for an organization para encontrar la fecha de la última actividad de cada usuario que tenga asignada una licencia en una organización. A continuación, puedes responder automáticamente filtrando por los usuarios que no han usado su licencia durante un periodo de tiempo determinado y enviándoles un recordatorio.
Escribir el mensaje de recordatorio
El recordatorio para los usuarios inactivos debe ayudarlos a superar los bloqueadores de adopción comunes de Copilot. Se recomienda identificar bloqueadores específicos para tu empresa mediante la realización de encuestas o de reuniones con los desarrolladores.
Por ejemplo, el mensaje podría incluir información y vínculos para ayudar a los usuarios a:
- Instalar Copilot en su entorno.
- Configurar Copilot para que funcione con el proxy o el firewall de la empresa.
- Sacar el máximo partido de Copilot en el trabajo diario.
También debes comunicar claramente cualquier otra medida que vayas a tomar si la licencia sigue sin usarse, como revocarla.
Recordatorio de ejemplo
En la sección a continuación, usaremos este mensaje en una automatización que crea una incidencia asignada a cada usuario inactivo.
Hemos observado que no has usado la licencia asignada de GitHub Copilot en 30 días. A continuación se indican algunos recursos que pueden ayudarte a empezar:
- Si aún no has configurado Copilot en tu entorno, consulta Configuración de GitHub Copilot para uno mismo o Solución de problemas comunes con GitHub Copilot.
- Para informarte sobre prácticas recomendadas y obtener consejos sobre cómo empezar, consulta Procedimientos recomendados para usar GitHub Copilot o Solicitud de ingeniería para GitHub Copilot.
- Para obtener ejemplos relacionados con tareas específicas, consulta Guía del Chat de Copilot.
Si ya no necesitas acceso a Copilot, háznoslo saber en esta incidencia. Si la licencia permanece inactiva durante más de 30 días, la revocaremos para cedérsela a otro usuario.
Recordatorio de ejemplo en 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.
Automatización de los recordatorios con GitHub Actions
En el flujo de trabajo de ejemplo a continuación se usa la API para identificar a los usuarios de una organización que no han usado su licencia durante 30 días y, a continuación, se crea una incidencia asignada a cada usuario. Este es un ejemplo sencillo que se puede adaptar para satisfacer tus necesidades.
Para usar este flujo de trabajo:
-
Crea una etiqueta en el repositorio donde se crearán incidencias de recordatorios. Llama a la etiqueta
copilot-reminder
. Usaremos esta etiqueta para comprobar si ya se ha abierto una incidencia de recordatorio para cada usuario inactivo.Para crear una etiqueta, consulta Administrar las etiquetas.
-
Guarda el mensaje de recordatorio, como el proporcionado en Recordatorio de ejemplo en Markdown, como una variable de GitHub Actions en el repositorio o la organización. Llama a la variable
COPILOT_REMINDER_MESSAGE
.Para crear una variable, consulta Almacenamiento de información en variables.
-
Crea una personal access token con permiso para llamar al punto de conexión de API List all Copilot seat assignments for an organization. Por ejemplo, crea un token específico con los detalles siguientes:
- Propietario del recurso: la organización donde buscas usuarios inactivos.
- Permisos de la organización: GitHub Copilot Business (solo lectura).
Para crear un token, consulta Administración de tokens de acceso personal.
-
Guarda el token de acceso como secreto de GitHub Actions en tu repositorio u organización. Llama al secreto
COPILOT_LICENSE_READ
.Para crear un secreto, consulta Uso de secretos en Acciones de GitHub.
-
Con el ejemplo a continuación, crea el flujo de trabajo en el repositorio donde quieres que se creen las incidencias de recordatorios.
Si es la primera vez que usas GitHub Actions, consulta Guía de inicio rápido para GitHub Actions.
-
En el flujo de trabajo, reemplaza los marcadores de posición
ORG/REPO
en los comandosgh
por el nombre del repositorio en el que quieres que se creen las incidencias de recordatorios. Por ejemplo:octo-org/octo-repo
.
Flujo de trabajo de ejemplo
Note
En este ejemplo se supone que asignas licencias a través de una organización. Si usas una cuenta de empresa dedicada para Copilot Business, tendrás que usar otros puntos de conexión de API. Consulta Configuración de una empresa dedicada de Copilot para empresas (cuentas personales).
# 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 }}