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 Ingeniería de solicitudes para Copilot Chat.
- 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 siguiente flujo de trabajo de ejemplo, se usa la API para identificar a los usuarios de una organización que no han utilizado su licencia durante 30 días o no la han utilizado en absoluto desde que se asignó el puesto 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.
-
Si quieres crear las incidencias en un repositorio distinto del que contiene el flujo de trabajo, reemplaza
${{ github.repository }}
en los comandos degh
por el nombre del repositorio donde quieres que se creen las incidencias de recordatorio. 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 GitHub Copilot license on: # Run on demand (enables `Run workflow` button on the Actions tab to easily trigger a run manually) workflow_dispatch: # Run the workflow every day at 8am UTC schedule: - cron: '0 8 * * *' jobs: context-log: runs-on: ubuntu-latest # Modify the default permissions granted to GITHUB_TOKEN permissions: contents: read issues: write steps: - name: Check last GitHub Copilot activity id: check-last-activity run: | # List all GitHub Copilot seat assignments for an organization 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/${{ github.repository_owner }}/copilot/billing/seats) echo "Raw Response from gh api:" echo "$RESPONSE" # Parse and check each user's `last_activity_at` and `created_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') CREATED_AT=$(echo "$seat" | jq -r '.created_at') # List all open issues with label `copilot-reminder` EXISTING_ISSUES=$(gh issue list --repo ${{ github.repository }} --assignee $LOGIN --label 'copilot-reminder' --json id) # Get last activity date and convert dates to seconds since epoch for comparison if [ "$LAST_ACTIVITY" = "null" ]; then LAST_ACTIVITY_DATE=$(date -d "$CREATED_AT" +%s) else LAST_ACTIVITY_DATE=$(date -d "$LAST_ACTIVITY" +%s) fi 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" NEW_ISSUE_URL="$(gh issue create --title "Reminder about your GitHub Copilot license" --body "${{ vars.COPILOT_REMINDER_MESSAGE }}" --repo ${{ github.repository }} --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 GH_TOKEN, required for the 'gh issue' commands env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Remind inactive users about GitHub Copilot license
on:
Name your workflow
workflow_dispatch:
Run on demand (enables Run workflow
button on the Actions tab to easily trigger a run manually)
schedule:
- cron: '0 8 * * *'
jobs:
context-log:
runs-on: ubuntu-latest
Run the workflow every day at 8am UTC
permissions:
contents: read
issues: write
steps:
- name: Check last GitHub Copilot activity
id: check-last-activity
run: |
Modify the default permissions granted to GITHUB_TOKEN
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/${{ github.repository_owner }}/copilot/billing/seats)
echo "Raw Response from gh api:"
echo "$RESPONSE"
List all GitHub Copilot seat assignments for an organization
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')
CREATED_AT=$(echo "$seat" | jq -r '.created_at')
Parse and check each user's last_activity_at
and created_at
EXISTING_ISSUES=$(gh issue list --repo ${{ github.repository }} --assignee $LOGIN --label 'copilot-reminder' --json id)
List all open issues with label copilot-reminder
if [ "$LAST_ACTIVITY" = "null" ]; then
LAST_ACTIVITY_DATE=$(date -d "$CREATED_AT" +%s)
else
LAST_ACTIVITY_DATE=$(date -d "$LAST_ACTIVITY" +%s)
fi
THIRTY_DAYS_AGO=$(date -d "30 days ago" +%s)
Get last activity date and 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"
NEW_ISSUE_URL="$(gh issue create --title "Reminder about your GitHub Copilot license" --body "${{ vars.COPILOT_REMINDER_MESSAGE }}" --repo ${{ github.repository }} --assignee $LOGIN --label 'copilot-reminder')"
else
echo "User $LOGIN is active or already has an assigned reminder issue. Last activity: $LAST_ACTIVITY"
fi
done
Create issues for inactive users who don't have an existing open issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Set the GH_TOKEN, required for the 'gh issue' commands
# Name your workflow
name: Remind inactive users about GitHub Copilot license
on:
# Run on demand (enables `Run workflow` button on the Actions tab to easily trigger a run manually)
workflow_dispatch:
# Run the workflow every day at 8am UTC
schedule:
- cron: '0 8 * * *'
jobs:
context-log:
runs-on: ubuntu-latest
# Modify the default permissions granted to GITHUB_TOKEN
permissions:
contents: read
issues: write
steps:
- name: Check last GitHub Copilot activity
id: check-last-activity
run: |
# List all GitHub Copilot seat assignments for an organization
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/${{ github.repository_owner }}/copilot/billing/seats)
echo "Raw Response from gh api:"
echo "$RESPONSE"
# Parse and check each user's `last_activity_at` and `created_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')
CREATED_AT=$(echo "$seat" | jq -r '.created_at')
# List all open issues with label `copilot-reminder`
EXISTING_ISSUES=$(gh issue list --repo ${{ github.repository }} --assignee $LOGIN --label 'copilot-reminder' --json id)
# Get last activity date and convert dates to seconds since epoch for comparison
if [ "$LAST_ACTIVITY" = "null" ]; then
LAST_ACTIVITY_DATE=$(date -d "$CREATED_AT" +%s)
else
LAST_ACTIVITY_DATE=$(date -d "$LAST_ACTIVITY" +%s)
fi
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"
NEW_ISSUE_URL="$(gh issue create --title "Reminder about your GitHub Copilot license" --body "${{ vars.COPILOT_REMINDER_MESSAGE }}" --repo ${{ github.repository }} --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 GH_TOKEN, required for the 'gh issue' commands
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}