Wenn du GitHub Copilot in einem Unternehmen einführst, solltest du unbedingt nachverfolgen, welche Benutzenden ihre Copilot-Lizenz verwenden, damit du effektiv reagieren kannst, indem du nicht verwendete Lizenzen neu zuweist oder Benutzenden bei den ersten Schritten mit Copilot hilfst.
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:
- Copilot in ihrer Umgebung zu installieren
- Copilot so einzurichten, dass der Dienst mit dem Proxy oder der Firewall deines Unternehmens funktioniert
- Copilot der täglichen Arbeit optimal einzusetzen
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 Issue für jedes inaktive Benutzerkonto erstellt.
Anscheinend hast du die Lizenz, die dir für GitHub Copilot zugewiesen wurde, in den letzten 30 Tagen nicht verwendet. Diese Ressourcen können dir bei den ersten Schritten helfen:
- Wenn du Copilot noch nicht in deiner Umgebung eingerichtet hast, lies Einrichten von GitHub Copilot für sich selbst oder Behandeln häufiger Probleme mit GitHub Copilot.
- Best Practices und Ratschläge zu den ersten Schritten findest du unter Best Practices für die Verwendung von GitHub Copilot oder Prompt Engineering für Copilot Chat.
- Beispiele für bestimmte Aufgaben findest du unter Copilot Chat-Cookbook.
Wenn du keinen Zugriff mehr auf Copilot benötigst, teile uns dies bitte in diesem Issue mit. Wenn deine Lizenz weitere 30 Tage lang inaktiv bleibt, wird sie widerrufen, um anderen Benutzenden den Zugriff zu ermöglichen.
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 Benutzenden in einer Organisation ermittelt, die ihre Lizenz 30 Tage lang nicht verwendet haben. Anschließend wird ein Issue für jedes der Benutzerkonten erstellt. Dieses einfache Beispiel lässt sich jederzeit an deine Anforderungen anpassen.
So verwendest du diesen Workflow:
-
Erstelle eine Bezeichnung in dem Repository, in dem Erinnerungsissues erstellt werden. Nenne die Bezeichnung
copilot-reminder
. Mithilfe dieser Bezeichnung wird für jedes inaktive Benutzerkonto überprüft, ob bereits ein Erinnerungsissue geöffnet wurde.Informationen zum Erstellen einer Bezeichnung findest du unter Verwalten von Bezeichnungen.
-
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 Endpunkt der API zum Auflisten aller Copilot-Arbeitsplatzzuweisungen für eine Organisation aufzurufen. Erstelle z. B. ein differenziertes Token mit den folgenden Details:
- Ressourcenbesitz: Die Organisation, in der du nach inaktiven Benutzerkonten suchst
- Organisationsberechtigungen: GitHub Copilot Business (schreibgeschützt)
Informationen zum Erstellen eines Tokens findest du unter Verwalten deiner persönlichen Zugriffstoken.
-
Speichere das Zugriffstoken als GitHub Actions-Geheimnis in deinem Repository oder deiner Organisation. Rufe das Geheimnis
COPILOT_LICENSE_READ
auf.Informationen zum Erstellen eines Geheimnisses findest du 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.
-
Ersetze im Workflow die
ORG/REPO
-Platzhalter in dengh
-Befehlen durch den Namen des Repositorys, in dem die Erinnerungsissues erstellt werden sollen. Beispiel:octo-org/octo-repo
Beispielworkflow
Note
In diesem Beispiel wird davon ausgegangen, dass du Lizenzen über eine Organisation zuweist. Wenn du ein dediziertes Unternehmenskonto für Copilot Business verwendest, musst du unterschiedliche API-Endpunkte verwenden. Weitere Informationen findest du unter Einrichten eines dedizierten Unternehmens für Copilot Business (persönliche Konten).
# 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 }}