Skip to content

Commit 61f1afb

Browse files
committed
adding in graphql for remove enterprise user
1 parent ce16eb5 commit 61f1afb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

gh-cli/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,15 @@ gh auth refresh -h github.com -s admin:org
209209

210210
Retrieves the ID of a user for other GraphQL calls
211211

212+
## remove-enterprise-user.sh
213+
214+
Removes an enterprise user. See notes:
215+
216+
1. Get enterprise id: `./get-enterprise-id.sh`
217+
2. Get user id by one of the following:
218+
1. List org members and get the id from there: `./get-organization-members.sh`
219+
2. Get user id: `./get-user-id.sh`
220+
212221
## rename-repo.sh
213222

214223
Renaming a repo

gh-cli/remove-enterprise-user.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# gh cli's token needs to be able to admin enterprise - run this first if it can't
4+
# gh auth refresh -h github.com -s admin:enterprise
5+
6+
# Notes:
7+
#
8+
# 1. Get enterprise id: `./get-enterprise-id.sh`
9+
# 2. Get user id by one of the following:
10+
# 1. List org members and get the id from there: `./get-organization-members.sh`
11+
# 2. Get user id: `./get-user-id.sh`
12+
13+
gh api graphql -f enterpriseId='E_kgDNCRQ' -f userId='U_kgDOBqwehQ' -f query='
14+
mutation($enterpriseId: ID!, $userId: ID!) {
15+
removeEnterpriseMember(input: {enterpriseId: $enterpriseId, userId: $userId}) {
16+
user {
17+
id
18+
login
19+
}
20+
}
21+
}'

0 commit comments

Comments
 (0)