maintainers/scripts: Lint check-maintainer-github-handles.sh (#147424)
This commit is contained in:
parent
facfb5b129
commit
de125e2333
|
@ -4,20 +4,19 @@
|
||||||
# Example how to work with the `lib.maintainers` attrset.
|
# Example how to work with the `lib.maintainers` attrset.
|
||||||
# Can be used to check whether all user handles are still valid.
|
# Can be used to check whether all user handles are still valid.
|
||||||
|
|
||||||
set -e
|
set -o errexit -o noclobber -o nounset -o pipefail
|
||||||
|
shopt -s failglob inherit_errexit
|
||||||
# nixpkgs='<nixpkgs>'
|
|
||||||
# if [ -n "$1" ]; then
|
|
||||||
|
|
||||||
function checkCommits {
|
function checkCommits {
|
||||||
local user="$1"
|
local ret status tmp user
|
||||||
local tmp=$(mktemp)
|
user="$1"
|
||||||
|
tmp=$(mktemp)
|
||||||
curl --silent -w "%{http_code}" \
|
curl --silent -w "%{http_code}" \
|
||||||
"https://github.com/NixOS/nixpkgs/commits?author=$user" \
|
"https://github.com/NixOS/nixpkgs/commits?author=$user" \
|
||||||
> "$tmp"
|
> "$tmp"
|
||||||
# the last line of tmp contains the http status
|
# the last line of tmp contains the http status
|
||||||
local status=$(tail -n1 "$tmp")
|
status=$(tail -n1 "$tmp")
|
||||||
local ret=
|
ret=
|
||||||
case $status in
|
case $status in
|
||||||
200) if <"$tmp" grep -i "no commits found" > /dev/null; then
|
200) if <"$tmp" grep -i "no commits found" > /dev/null; then
|
||||||
ret=1
|
ret=1
|
||||||
|
@ -31,7 +30,7 @@ function checkCommits {
|
||||||
checkCommits "$user"
|
checkCommits "$user"
|
||||||
ret=$?
|
ret=$?
|
||||||
;;
|
;;
|
||||||
*) printf "BAD STATUS: $(tail -n1 $tmp) for %s\n" "$user"; ret=1
|
*) printf "BAD STATUS: $(tail -n1 "$tmp") for %s\n" "$user"; ret=1
|
||||||
ret=1
|
ret=1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -63,4 +62,5 @@ nix-instantiate -A lib.maintainers --eval --strict --json \
|
||||||
| jq -r '.[]|.github|select(.)' \
|
| jq -r '.[]|.github|select(.)' \
|
||||||
| parallel -j5 checkUser
|
| parallel -j5 checkUser
|
||||||
|
|
||||||
|
# To check some arbitrary users:
|
||||||
# parallel -j100 checkUser ::: "eelco" "profpatsch" "Profpatsch" "a"
|
# parallel -j100 checkUser ::: "eelco" "profpatsch" "Profpatsch" "a"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user