Skip to content

Instantly share code, notes, and snippets.

@fricklerhandwerk
Created August 5, 2022 12:41
Show Gist options
  • Save fricklerhandwerk/b1909bf93f4d1c3402fd354397ebd78a to your computer and use it in GitHub Desktop.
Save fricklerhandwerk/b1909bf93f4d1c3402fd354397ebd78a to your computer and use it in GitHub Desktop.
Query your GitHub involvement in the past
#!/usr/bin/env nix-shell
#!nix-shell -i fish -p gh -I nixpkgs=channel:nixos-22.05
argparse --min-args 2 "h/help" "a/arg=+" -- $argv
or begin echo "
specify query and interval, for example:
pr 1 week
issue 3 days
pass additional flags to `gh` with -a/--arg, for example:
pr 1 week -a --merged -a visibility=public
issue 3 days -a --author=@me
"
and exit
end
set interval (date --iso-8601 -d "now - $argv[2..]")..(date --iso-8601)
set template '"- ["+(.repository.nameWithOwner)+"#"+(.number|tostring)+"](https://github.com/"+(.repository.nameWithOwner)+"/pulls/"+(.number|tostring)+") "+(.title)'
switch $argv[1]
case issue issues
set type issues
case pr prs
set type prs
end
gh search $type $_flag_arg --involves @me \
--updated $interval \
--json repository,number,title -q ".[] | $template" | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment