about summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-10-21 18:25:54 -0400
committerJoshua Nelson <joshua@yottadb.com>2020-10-22 09:08:04 -0400
commit9354c4f98beb338ada1b2da59c5858ba222aca1b (patch)
tree9c19905b55d96361ea48397d5f35b16e181889a9 /src/doc/rustc-dev-guide
parentd26d3ea29e31bf2d255b7ee98006e7f2d4fb90b0 (diff)
downloadrust-9354c4f98beb338ada1b2da59c5858ba222aca1b.tar.gz
rust-9354c4f98beb338ada1b2da59c5858ba222aca1b.zip
Add a `check-in.sh` script to automate writing markdown links
Example usage:

```
$ ./check-in.sh
usage: ./check-in.sh <since> <number-of-prs-merged>
$ ./check-in.sh 2020-09-03
usage: ./check-in.sh <since> <number-of-prs-merged>
help: you can find the number of PRs merged at https://github.com/rust-lang/rustc-dev-guide/pulls?q=is%3Apr+is%3Aclosed+updated%3A%3E2020-09-03
$ ./check-in.sh 2020-09-03 72
Authors:
- **@1c3t3a**
- **@arora-aman**
... snip ...
Changes:
- Replace links to `buildbot2.r-l.o` with `bors.r-l.o` [#929](https://github.com/rust-lang/rustc-dev-guide/pull/929)
- Add reference PRs for `r?` and `r+` comments [#928](https://github.com/rust-lang/rustc-dev-guide/pull/928)
... snip ...
Changes in progress:
```
Diffstat (limited to 'src/doc/rustc-dev-guide')
-rwxr-xr-xsrc/doc/rustc-dev-guide/ci/check-in.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/ci/check-in.sh b/src/doc/rustc-dev-guide/ci/check-in.sh
new file mode 100755
index 00000000000..d41a7ae5780
--- /dev/null
+++ b/src/doc/rustc-dev-guide/ci/check-in.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -eu
+
+# This is not a very smart script
+if [ $# != 2 ]; then
+  echo "usage: $0 <since> <number-of-prs-merged>"
+  if [ $# = 1 ] ; then
+    echo "help: you can find the number of PRs merged at" \
+      "https://github.com/rust-lang/rustc-dev-guide/pulls?q=is%3Apr+is%3Aclosed+updated%3A%3E$1"
+  fi
+  exit 1
+fi
+
+curl() {
+  command curl -s "$@"
+}
+
+# Get recently updated PRs
+curl "https://api.github.com/repos/rust-lang/rustc-dev-guide/pulls?state=closed&per_page=$2" \
+  | jq '[.[] | select(.merged_at > "'"$1"'")]' > pulls.json
+
+show_pulls() {
+  jq -r '.[] | { title, number, html_url, user: .user.login } | "- " + .title + " [#" + (.number | tostring) + "](" + .html_url + ")"'
+}
+
+echo "Authors:"
+jq -r '{ login: .[].user.login } | "- **@" + .login + "**"' < pulls.json | sort -u
+echo "Changes:"
+show_pulls < pulls.json
+echo "Changes in progress:"
+# If there are more than 30 PRs open at a time, you'll need to set `per_page`.
+# For now this seems unlikely.
+curl "https://api.github.com/repos/rust-lang/rustc-dev-guide/pulls?state=open" | show_pulls