-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-open-pull-requests.ss
More file actions
36 lines (33 loc) · 1013 Bytes
/
github-open-pull-requests.ss
File metadata and controls
36 lines (33 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(import :clojerbil/core
:std/net/request
:std/sugar
:std/text/json
"github")
(export main)
(define (query username)
(string-append
"query {
user(login: \"" username "\") {
pullRequests(first: 100, states: OPEN) {
nodes {
url
title
}
}
}
}"))
(define (post-data username)
(json-object->string (hash (query (query username)))))
(define (main)
(let-hash (hub-config)
(let* ((request (http-post
"https://api.github.com/graphql"
headers: `(("Authorization" . ,(string-append "bearer " .oauth_token)))
data: (post-data .user)))
(nodes (get-in (request-json request) '(data user pullRequests nodes))))
(for-each (lambda (node)
(display (hash-ref node 'url))
(display " ")
(display (hash-ref node 'title))
(newline))
nodes))))