-
Notifications
You must be signed in to change notification settings - Fork 11
Add gh helper scripts for admin purpose #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
james-bruten-mo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks sensible to me. Passing to Sam to also have a look
t00sa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've suggested some extra code to prevent admins from removing their own access from a repository, but looks good otherwise.
| remove_collaborator() { | ||
| local repo_name="$1" | ||
| local repo_api="/repos/${OWNER}/${repo_name}/collaborators/${USERNAME}" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a check which prevents users from removing their own account, e.g.
| if [[ $(gh api user --jq ".login") == $USERNAME ]]; then | |
| echo "Cannot remove the current user" | |
| return | |
| fi | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t00sa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks sensible. Approved.
Description
Summary
Add few helper scripts to assist GitHub admin tasks.
Checklist