-
-
Save KyMidd/1a2ce47dc5378f50bd47395e1a1a27a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Remove user from copilot | |
| remove_user_from_copilot() { | |
| REMOVE_USER_FROM_COPILOT=$(curl -sL \ | |
| -X DELETE \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/orgs/$gh_org/copilot/billing/selected_users \ | |
| -d "{\"selected_usernames\":[\"$copilot_user\"]}") | |
| # If response contains json key seats_cancelled, it worked | |
| if [[ $REMOVE_USER_FROM_COPILOT == *"seats_cancelled"* ]]; then | |
| echo "✅ User $copilot_user removed from CoPilot" | |
| else | |
| echo "❌ Failed to remove user $copilot_user from CoPilot, please investigate:" | |
| echo "$REMOVE_USER_FROM_COPILOT" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment