aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-18 22:41:35 +0200
committerTeddy Wing2018-04-18 22:42:17 +0200
commitbdf52d9daa06b1225f4bbe893a6049b5f2123426 (patch)
tree0012e6de345134ed05370804fae4dfe5e78da438
parentf62b3a760b2d7ed3001c43f3c00ae9efcb08bec9 (diff)
downloadredprine-bdf52d9daa06b1225f4bbe893a6049b5f2123426.tar.bz2
cache_my_pull_requests(): Reuse `extract_data_from_pull_request_json`
Get rid of duplicated PR hash building and filtering code.
-rwxr-xr-xredprine15
1 files changed, 1 insertions, 14 deletions
diff --git a/redprine b/redprine
index 5d5d047..32a1445 100755
--- a/redprine
+++ b/redprine
@@ -38,20 +38,7 @@ function fetch_pull_requests () {
function cache_my_pull_requests () {
local pull_requests="$1"
- local my_pull_requests=$(
- printf "%s\n" "$pull_requests" |
- jq '. |
- map({
- html_url,
- number,
- user: .user.login,
- ref: .head.ref,
- created_at
- }) |
- map(
- select(.user == "teddywing")
- )'
- )
+ local my_pull_requests=$(extract_data_from_pull_request_json "$pull_requests")
echo "$my_pull_requests" > "$CACHE_FILE"
}