summary refs log tree commit diff
path: root/maintainers/scripts/check-maintainer-github-handles.sh
blob: e389fde7d8aa8558958275e22607a1d59b4564f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p jq parallel

# Example how to work with the `lib.maintainers` attrset.
# Can be used to check whether all user handles are still valid.

set -e

# checks whether a user handle can be found on github
function checkUser {
    local user="$1"
    local status=
    status="$(curl --silent --head "https://github.com/${user}" | grep Status)"
    printf "%s\t\t\t\t%s\n" "$status" "$user"
}
export -f checkUser

# output the maintainers set as json
# and filter out the github username of each maintainer (if it exists)
# then check 100 at the same time
nix-instantiate -A lib.maintainers --eval --strict --json \
    | jq -r '.[]|.github' \
    | parallel -j100 checkUser