Wenn Sie GitHub Copilot in einem Unternehmen einführen, ist es wichtig, den Überblick darüber zu behalten, welche Benutzer ihre Copilot-Lizenz nutzen. So können Sie effektiv reagieren, indem Sie ungenutzte Lizenzen neu zuweisen oder den Benutzern helfen, sich mit Copilot vertraut zu machen.
Mit dem Endpunkt der API zum Auflisten aller Copilot-Arbeitsplatzzuweisungen für eine Organisation kannst du für alle Benutzenden, denen in einer Organisation eine Lizenz zugewiesen ist, das Datum der letzten Aktivität ermitteln. Anschließend kannst du automatisiert reagieren, indem du nach den Benutzenden filterst, die ihre Lizenz für einen bestimmten Zeitraum nicht verwendet haben, und ihnen eine Erinnerung sendest.
Schreiben der Erinnerungsnachricht
Deine Erinnerung sollte inaktiven Benutzenden helfen, häufige Hindernisse bei der Einführung von Copilot zu überwinden. Wir empfehlen, konkrete Hindernisse in deinem Unternehmen zu ermitteln, indem du Umfragen durchführst oder dich in der Entwicklungsabteilung umhörst.
Die Nachricht kann beispielsweise Informationen und Links enthalten, die Benutzenden dabei helfen:
- Installieren Sie Copilot in deren Umgebung.
- Richte Copilot so ein, dass der Dienst mit dem Proxy oder der Firewall deines Unternehmens funktioniert.
- Das Beste aus Copilot im täglichen Arbeitsalltag herausholen.
Du solltest auch alle Maßnahmen klar kommunizieren, die du ergreifen wirst, wenn die Lizenz weiterhin nicht verwendet wird, z. B. das Widerrufen der Lizenz.
Beispielerinnerung
Im nächsten Abschnitt wird diese Meldung in einer Automatisierung verwendet, die ein Problem für jeden inaktiven Benutzer erstellt.
Anscheinend hast du die Lizenz, die dir für GitHub Copilot zugewiesen wurde, in den letzten 30 Tagen nicht verwendet. Hier sind einige Ressourcen, die Ihnen beim get started helfen können:
- Wenn du Copilot in deiner Umgebung noch nicht eingerichtet hast, lies Einrichten von GitHub Copilot für sich selbst oder Behandeln häufiger Probleme mit GitHub Copilot.
- Bewährte Methoden und Ratschläge zu getting started finden Sie unter Bewährte Methoden für die Verwendung von GitHub Copilot oder Prompt-Engineering für GitHub Copilot Chat.
- Beispiele für bestimmte Vorgänge finden Sie unter GitHub Copilot Chat-Cookbook.
Falls Sie keinen Zugriff mehr auf Copilot benötigen, teilen Sie uns dies bitte in diesem Issue mit. Wenn Ihre Lizenz für weitere 30 Tage inaktiv bleibt, widerrufen wir sie, um access für einen anderen Benutzer freizugeben.
Beispielerinnerung 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.
Automatisieren der Erinnerung mit GitHub Actions
Im folgenden Beispielworkflow werden mithilfe der API die Benutzer in einer Organisation ermittelt, die ihre Lizenz entweder 30 Tage lang nicht verwendet haben oder sie seit der Zuweisung des Sitzes überhaupt nicht genutzt haben. Anschließend wird ein Problem für jedes Benutzerkonto erstellt. Dieses einfache Beispiel lässt sich jederzeit an deine Anforderungen anpassen.
So verwendest du diesen Workflow:
-
Erstelle ein Label in dem Repository, in dem Erinnerungsprobleme erstellt werden. Nenne es
copilot-reminder. Wir verwenden dieses Label, um zu überprüfen, ob für eine inaktive benutzende Person bereits ein Erinnerungsproblem geöffnet wurde.Informationen zum Erstellen einer Bezeichnung findest du unter Verwalten von Labels.
-
Speichere deine Erinnerungsnachricht (z. B. die unter Beispielerinnerung in Markdown bereitgestellte) als GitHub Actions-Variable in deinem Repository oder deiner Organisation. Nenne die Variable
COPILOT_REMINDER_MESSAGE.Informationen zum Erstellen einer Variablen findest du unter Speichern von Informationen in Variablen.
-
Erstelle ein personal access token mit der Berechtigung, den API-Endpunkt Alle Copilot-Lizenzzuweisungen für eine Organisation auflisten aufzurufen. Du kannst beispielsweise ein granulares Token mit den folgenden Angaben erstellen: * Ressourceneigentümer: Die Organisation, in der du nach inaktiven Benutzern suchst. * Organisationsberechtigungen: GitHub Copilot Business (schreibgeschützt).
Informationen zum Erstellen eines Tokens finden Sie unter Verwalten deiner persönlichen Zugriffstoken.
-
Speichern Sie das access-Token als GitHub Actions geheimen Schlüssel in Ihrem Repository oder Ihrer Organisation. Rufe das geheimnisvolle Element
COPILOT_LICENSE_READauf.Informationen zum Erstellen eines geheimen Schlüssels finden Sie unter Verwenden von Geheimnissen in GitHub-Aktionen.
-
Erstelle den Workflow mithilfe des folgenden Beispiels in dem Repository, in dem die Erinnerungsissues erstellt werden sollen.
Wenn du gerade erst mit der Verwendung von GitHub Actions begonnen hast, findest du weitere Informationen unter Schnellstart für GitHub Actions.
-
Wenn Sie die Probleme in einem anderen Repository als dem Repository erstellen möchten, in dem sich der Workflow befindet, ersetzen Sie
${{ github.repository }}in den Befehlenghdurch den Namen des Repositorys, in dem die Erinnerungsprobleme erstellt werden sollen. Beispiel:octo-org/octo-repo
Beispielworkflow
Hinweis
In diesem Beispiel wird davon ausgegangen, dass du Lizenzen über eine Organisation zuweist. Ähnliche API-Endpunkte sind für Unternehmenskonten und Unternehmensteams vorhanden. Weitere Informationen findest du unter REST-API-Endpunkte für Copilot Benutzerverwaltung.
# 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-latestRun 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
doneCreate 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 }}
Weitere Informationen
-
[AUTOTITLE](/copilot/reference/metrics-data#last_activity_at) -
[AUTOTITLE](/copilot/rolling-out-github-copilot-at-scale/driving-copilot-adoption-in-your-company) -
[AUTOTITLE](/copilot/rolling-out-github-copilot-at-scale/analyzing-usage-over-time-with-the-copilot-metrics-api)