-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetOrgAdmins.sh
More file actions
44 lines (32 loc) · 912 Bytes
/
getOrgAdmins.sh
File metadata and controls
44 lines (32 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
#
# Trap interrupts (Ctrl+C, SIGINT, etc.) to restore echoing before exiting
trap 'stty echo; exit' INT TERM HUP EXIT
# Prompt user
printf "Enter your password: "
# Disable terminal echoing
stty -echo
# Read password into variable
read -r TOKEN
# Restore echoing
stty echo
# Add a newline after input
echo
# Use the password
echo "Password received (hidden for security)!"
echo "running script now..."
OUTFILE="blw_github_org_owners.txt"
{
# Timestamp for the run
echo "###################################"
echo "Run timestamp: $(date '+%Y-%m-%d %H:%M:%S')"
echo "###################################"
echo
curl -s -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/orgs/blw-ofag-ufag/members?role=admin" |
jq -r '.[].login'
echo
echo "###################################"
echo
} >> "$OUTFILE"