2023-04-01 18:21:41 -04:00
#! /usr/bin/env nix-shell
2023-04-06 16:53:54 -04:00
#! nix-shell -i bash -p bash gh
2023-04-01 18:21:41 -04:00
set -euo pipefail
if [ $# -eq 0 ] ; then
echo "Usage: query-prs.sh <from YYYY-MM-DD> <to YYYY-MM-DD>"
exit 1
fi
from_date = " $1 "
to_date = " $2 "
pr_fields = "number,title,author,url"
pr_template = "{{range .}}- [#{{.number}}]({{.url}}) {{.title}} ([@{{.author.login}}](https://github.com/{{.author.login}})){{printf \"\n\"}}{{end}}"
tracking_issue_template = "{{range .}}- [#{{.number}}]({{.url}}) {{.title}}{{printf \"\n\"}}{{end}}"
# Lists the PRs merged from a repository between certain dates, optionally filtered by labels
list_merged_prs( ) {
if [ $# -gt 1 ] ; then
repo = " $1 "
labels = " $2 "
gh pr list -R " $repo " --search " is:merged merged: $from_date .. $to_date label:\" $labels \" " --json " $pr_fields " --template " $pr_template "
else
repo = " $1 "
gh pr list -R " $repo " --search " is:merged merged: $from_date .. $to_date " --json " $pr_fields " --template " $pr_template "
fi
}
# Lists the PRs opened on a repository
list_opened_prs( ) {
if [ $# -gt 1 ] ; then
repo = " $1 "
labels = " $2 "
gh pr list -R " $repo " --search " is:unmerged created: $from_date .. $to_date label:\" $labels \" " --json " $pr_fields " --template " $pr_template "
else
repo = " $1 "
gh pr list -R " $repo " --search " is:unmerged created: $from_date .. $to_date " --json " $pr_fields " --template " $pr_template "
fi
}
# Lists all of the tracking issues opened on nix.dev within the specified dates
list_new_tracking_issues( ) {
gh issue list -R "nixos/nix.dev" --search " created: $from_date .. $to_date label:tracking " --json " $pr_fields " --template " $tracking_issue_template "
}
2023-04-06 16:53:54 -04:00
cat << EOF
2023-05-06 13:40:45 -04:00
# This Month in Nix Docs - #NUMBER - MONTH YEAR
2023-04-06 16:53:54 -04:00
## Community
The Documentation Team can be found in a number of places. Check the [ Documentation Team page] ( https://nixos.org/community/teams/documentation.html) and drop in if you' d like to contribute!
## Projects
## RFCs
## Documentation PRs Merged
# AUTOGENERATED
EOF
2023-04-01 18:21:41 -04:00
echo "## PRs"
echo
echo "### NixOS/nix"
list_merged_prs "nixos/nix" "documentation"
echo
echo "### NixOS/nixpkgs"
list_merged_prs "nixos/nixpkgs" "6.topic: documentation"
echo
echo "### NixOS/nix-pills"
list_merged_prs "nixos/nix-pills"
echo
echo "### NixOS/nix.dev"
list_merged_prs "nixos/nix.dev"
echo
echo "## RFCs"
echo
echo "### Opened (manually check for relevance)"
list_opened_prs "nixos/rfcs"
echo
echo "### Accepted (manually check for relevance)"
list_merged_prs "nixos/rfcs"
echo
echo "## New Tracking Issues"
list_new_tracking_issues
echo