From 6ee0e225909f85c6b918bf9042c1df509b48db3b Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Tue, 24 Jan 2017 11:00:00 +0100 Subject: [PATCH] Add script to save data from GitHub issues, pull requests, and comments. --- build/github-data.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 build/github-data.sh diff --git a/build/github-data.sh b/build/github-data.sh new file mode 100755 index 00000000..69b030cd --- /dev/null +++ b/build/github-data.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +get_next() { + grep Link: log | tr , '\n' | grep 'rel="next"' | sed 's/.*<\(.*\)>.*/\1/' +} + +get_data() { + file=$1 + url="https://api.github.com/$2" + n=1 + while test -n "$url"; do + wget -S -o log -O "$file$n" "$url" + url=`get_next` + echo "NEXT: >>>$url<<<" + n=`expr $n + 1` + done +} + +repo="PDP-10/its" +get_data issues "repos/$repo/issues?state=all&per_page=100" +get_data pulls "repos/$repo/pulls?state=all&per_page=100" +get_data comments "repos/$repo/issues/comments?per_page=100"