Skip to content

Instantly share code, notes, and snippets.

@pbsds
Forked from lorenzleutgeb/committer-progress.sh
Last active September 5, 2026 14:53
Show Gist options
  • Select an option

  • Save pbsds/7af827a53c103cd3d40902f9b0b21843 to your computer and use it in GitHub Desktop.

Select an option

Save pbsds/7af827a53c103cd3d40902f9b0b21843 to your computer and use it in GitHub Desktop.
Nixpkgs Committer Progress
#! /usr/bin/env nix-shell
#! nix-shell --pure -i bash -p bash gh jq cacert
set -eu
# MIT No Attribution (SPDX Identifier: MIT-0)
#
# Copyright 2023-2026 Lorenz Leutgeb, Peder Bergebakken Sundt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# based on <https://gist.github.com/lorenzleutgeb/239214f1d60b1cf8c79e7b0dc0483deb>.
footer="<sup>Generated with <https://gist.github.com/pbsds/7af827a53c103cd3d40902f9b0b21843>.</sup>"
# Will exit non-zero if not authenticated.
gh auth status
# TODO: set -- this?
## Default to currently logged in user.
#LOGIN=$(gh api user --jq .login)
while [[ $# -ge 1 ]]; do
# Pass GitHub username as commandline argument.
LOGIN="$1"
shift
uri_escape() { jq <<<"$1" -R '@uri' -r; }
CMD=( gh pr list --repo NixOS/nixpkgs --json id --jq length --limit 1000 )
mk_cell() {
#local label="$1"; shift
local query="$1"; shift
local count=$( "${CMD[@]}" --search "$query" --state all )
local uri="https://github.com/NixOS/nixpkgs/issues?q=$( uri_escape "$query" )";
#echo "[$count $label]($uri)"
echo "[$count]($uri)"
}
P_AUTHORED=$( mk_cell "is:pr author:$LOGIN" )
P_MERGED=$( mk_cell "is:pr author:$LOGIN is:merged" )
P_REVIEWED=$( mk_cell "is:pr reviewed-by:$LOGIN -author:$LOGIN" )
P_REVIEWED_SANS_BOT=$( mk_cell "is:pr reviewed-by:$LOGIN -author:$LOGIN -author:r-ryantm" )
P_COMMENTED=$( mk_cell "is:pr commenter:$LOGIN -reviewed-by:$LOGIN -author:$LOGIN" )
P_COMMENTED_SANS_BOT=$( mk_cell "is:pr commenter:$LOGIN -reviewed-by:$LOGIN -author:$LOGIN -author:r-ryantm" )
P_INVOLVED=$( mk_cell "is:pr involves:$LOGIN -commenter:$LOGIN -reviewed-by:$LOGIN -author:$LOGIN" )
P_INVOLVED_SANS_BOT=$( mk_cell "is:pr involves:$LOGIN -commenter:$LOGIN -reviewed-by:$LOGIN -author:$LOGIN -author:r-ryantm" )
CMD=( gh issue list --repo NixOS/nixpkgs --json id --jq length --limit 1000 )
I_AUTHORED=$( mk_cell "is:issue author:$LOGIN" )
I_COMMENTED=$( mk_cell "is:issue commenter:$LOGIN -author:$LOGIN" )
I_INVOLVED=$( mk_cell "is:issue involves:$LOGIN -commenter:$LOGIN -author:$LOGIN" )
cat << EOF
----
# @$LOGIN
| | \# | \# excluding @r-ryantm |
| :-- | -- | -- |
| **PRs authored** | $P_AUTHORED | _N/A_ |
| **PRs authored & merged** | $P_MERGED | _N/A_ |
| **PRs reviewed** | $P_REVIEWED | $P_REVIEWED_SANS_BOT |
| **PRs otherwise commented** | $P_COMMENTED | $P_COMMENTED_SANS_BOT |
| **PRs otherwise involved** | $P_INVOLVED | $P_INVOLVED_SANS_BOT |
| **Issues authored** | $I_AUTHORED | _N/A_ |
| **Issues otherwise commented** | $I_COMMENTED | _N/A_ |
| **Issues otherwise involved** | $I_INVOLVED | _N/A_ |
EOF
done
echo
echo "$footer"
@pbsds

pbsds commented Aug 16, 2026

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment