#!/usr/bin/env nix-shell #!nix-shell -i bash -p curl jq sta # https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line TOKEN= #response=$(curl -sS -H "Authorization: token $TOKEN" https://api.github.com/users/$1) # #echo " githubId = $(echo "$response" | jq -r '.id');" | tee /dev/stderr | /nix/store/5ghdbn3lmbaqdj7dba0a5m1hb2949zwy-xclip-0.13/bin/xclip -selection clipboard #exit 0 forHandle() { local handle=$1 local github=$1 echo -n "For handle $handle the previous github login was $github. " commit=$(git -C ~/src/nixpkgs log --follow -S "$handle" --pretty=format:%H maintainers/maintainer-list.nix | tail -1) echo -n "Found commit $commit . " query=$(cat <<-EOF { repository(name: "nixpkgs", owner: "NixOS") { object(expression: "$commit") { ... on Commit { associatedPullRequests(first: 10) { nodes { author { ... on User { databaseId login } } } } author { user { databaseId login } } } } } } EOF ) DATA=$(jq -n --arg query "$query" '{ query : $query }') response=$(curl -sS -H "Authorization: token $TOKEN" -d "$DATA" https://api.github.com/graphql) result=$(echo "$response" | jq '[ .data.repository.object | ( .author.user , .associatedPullRequests.nodes[].author) ] | map(select(. != null)) | unique[] | "\(.login) \(.databaseId)"' -r) if [ -z "$result" ]; then count=0 else count=$(echo "$result" | wc -l) fi if [ "$count" -eq 0 ]; then echo -e "\e[31mCouldn't figure out who the author is!\e[0m" elif [ "$count" -eq 1 ]; then read login id <<< "$result" echo -n "Found author with login $login and id $id. " if [ "$github" = "$login" ]; then echo -e "\e[32mThis is the same as the one in the maintainer file\e[0m" else echo -e "\e[31mThis is NOT the same as the one in the maintainer file!\e[0m" fi else echo -e "\e[31mDifferent commit author than PR author!\e[0m" fi } forHandle DerGuteMoritz DerGuteMoritz forHandle Fresheyeball fresheyeball forHandle MP2E MP2E forHandle Mogria mogria forHandle MtP MtP76 forHandle abbradar abbradar forHandle acairncross acairncross forHandle adamt adamtulinius forHandle aforemny aforemny forHandle ak alexanderkjeldaas forHandle alunduil alunduil forHandle ambrop72 ambrop72 forHandle aminb aminb forHandle andreabedini andreabedini forHandle andres kosmikus forHandle andsild andsild forHandle antono antono forHandle auntie auntie forHandle averelld averelld forHandle backuitist backuitist forHandle badi badi forHandle berdario berdario forHandle bluescreen303 bluescreen303 forHandle boothead boothead forHandle coconnor coreyoconnor forHandle cransom cransom forHandle davidrusu davidrusu forHandle desiderius desiderius forHandle dgonyeo dgonyeo forHandle doublec doublec forHandle dxf dingxiangfei2009 forHandle edanaher edanaher forHandle emmanuelrosa emmanuelrosa forHandle ericsagnes ericsagnes forHandle ertes ertes forHandle fare fare forHandle fdns fdns forHandle fragamus fragamus forHandle freezeboy freezeboy forHandle garbas garbas forHandle gavin gavinrogers forHandle gridaphobe gridaphobe forHandle hkjn hkjn forHandle infinisil infinisil forHandle j03 johannesloetzsch forHandle jasoncarr jasoncarr0 forHandle jeschli jeschli forHandle jfb tftio forHandle jitwit jitwit forHandle joamaki joamaki forHandle joepie91 joepie91 forHandle jonathanmarler marler8997 forHandle juliendehos juliendehos forHandle jyp jyp forHandle kampfschlaefer kampfschlaefer forHandle knairda KnairdA forHandle koral k0ral forHandle laikq laikq forHandle lassulus Lassulus forHandle lebastr lebastr forHandle leonardoce leonardoce forHandle lovek323 lovek323 forHandle ltavard ltavard forHandle lumi lumi-me-not forHandle matthewbauer matthewbauer forHandle matti-kariluoma matti-kariluoma forHandle melsigl melsigl forHandle michaelpj michaelpj forHandle michelk michelk forHandle minijackson minijackson forHandle mirdhyn mirdhyn forHandle mkf mkf forHandle mmlb mmlb forHandle mpscholten mpscholten forHandle mredaelli mredaelli forHandle nand0p nand0p forHandle ngerstle ngerstle forHandle olynch olynch forHandle orbitz orbitz forHandle pcarrier pcarrier forHandle plchldr plchldr forHandle pmeunier P-E-Meunier forHandle polyrod polyrod forHandle rafaelgg rafaelgg forHandle rickynils rickynils forHandle rob rbvermaa forHandle robberer robberer forHandle rvolosatovs rvolosatovs forHandle ryansydnor ryansydnor forHandle sander svanderburg forHandle scalavision scalavision forHandle schmittlauch schmittlauch forHandle scubed2 scubed2 forHandle shazow shazow forHandle shlevy shlevy forHandle shmish111 shmish111 forHandle sjmackenzie sjmackenzie forHandle sprock sprock forHandle srghma srghma forHandle taha tgharib forHandle tckmn tckmn forHandle tesq0 tesq0 forHandle teto teto forHandle the-kenny the-kenny forHandle timbertson timbertson forHandle timma ktrsoft forHandle tnias tnias forHandle tscholak tscholak forHandle tvestelind tvestelind forHandle tweber thorstenweber83 forHandle twey twey forHandle uwap uwap forHandle valeriangalliat valeriangalliat forHandle vcanadi vcanadi forHandle viric viric forHandle vizanto vizanto forHandle vmchale vmchale forHandle wscott wscott forHandle xnaveira xnaveira forHandle y0no y0no forHandle zalakain umazalakain