Skip to content

Commit e75c72b

Browse files
jyn514Joshua Nelson
authored andcommitted
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](#929) - Add reference PRs for `r?` and `r+` comments [#928](#928) ... snip ... Changes in progress: ```
1 parent 47893ba commit e75c72b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

ci/check-in.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
# This is not a very smart script
6+
if [ $# != 2 ]; then
7+
echo "usage: $0 <since> <number-of-prs-merged>"
8+
if [ $# = 1 ] ; then
9+
echo "help: you can find the number of PRs merged at" \
10+
"https://github.com/rust-lang/rustc-dev-guide/pulls?q=is%3Apr+is%3Aclosed+updated%3A%3E$1"
11+
fi
12+
exit 1
13+
fi
14+
15+
curl() {
16+
command curl -s "$@"
17+
}
18+
19+
# Get recently updated PRs
20+
curl "https://api.github.com/repos/rust-lang/rustc-dev-guide/pulls?state=closed&per_page=$2" \
21+
| jq '[.[] | select(.merged_at > "'"$1"'")]' > pulls.json
22+
23+
show_pulls() {
24+
jq -r '.[] | { title, number, html_url, user: .user.login } | "- " + .title + " [#" + (.number | tostring) + "](" + .html_url + ")"'
25+
}
26+
27+
echo "Authors:"
28+
jq -r '{ login: .[].user.login } | "- **@" + .login + "**"' < pulls.json | sort -u
29+
echo "Changes:"
30+
show_pulls < pulls.json
31+
echo "Changes in progress:"
32+
# If there are more than 30 PRs open at a time, you'll need to set `per_page`.
33+
# For now this seems unlikely.
34+
curl "https://api.github.com/repos/rust-lang/rustc-dev-guide/pulls?state=open" | show_pulls

0 commit comments

Comments
 (0)