mirror of
https://github.com/NixOS/nix.dev.git
synced 2024-10-18 14:32:43 -04:00
Add script for generating This Month in Nix Docs
This commit is contained in:
parent
a0fc4f1dcd
commit
257df21cee
9
maintainers/this-month-in-nix-docs/README.md
Normal file
9
maintainers/this-month-in-nix-docs/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# This Month in Nix Docs
|
||||||
|
This is a script and template for compiling "This Month in Nix Docs". The process is semi-automated. The script queries a collection of Nix repositories, looking for merged PRs with documentation-related labels, RFCs (you have to look through these manually), and tracking issues in this repository.
|
||||||
|
|
||||||
|
A new post is created via:
|
||||||
|
```
|
||||||
|
$ ./new-post.sh <from YYYY-MM-DD> <to YYYY-MM-DD> >new-post.md
|
||||||
|
```
|
||||||
|
|
||||||
|
After this invocation a template post (`new-post.md`) will be filled out with the GitHub query results formatted as markdown at the end of the file. You'll also need to fill in the number and year/month at the top of the post.
|
80
maintainers/this-month-in-nix-docs/make-post.sh
Executable file
80
maintainers/this-month-in-nix-docs/make-post.sh
Executable file
|
@ -0,0 +1,80 @@
|
||||||
|
#! /usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p gh
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
cat template.md
|
||||||
|
|
||||||
|
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
|
12
maintainers/this-month-in-nix-docs/template.md
Normal file
12
maintainers/this-month-in-nix-docs/template.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# This Month in Nix Docs - #**NUMBER** - **MONTH** **YEAR**
|
||||||
|
|
||||||
|
## Community
|
||||||
|
You can always find the Documentation Team on Matrix: [Nix Documentation](https://matrix.to/#/#docs:nixos.org). Drop in if you'd like to contribute!
|
||||||
|
|
||||||
|
## Projects
|
||||||
|
|
||||||
|
## RFCs
|
||||||
|
|
||||||
|
## Documentation PRs Merged
|
||||||
|
|
||||||
|
# AUTOGENERATED
|
Loading…
Reference in a new issue