-
Notifications
You must be signed in to change notification settings - Fork 1
/
03-issues-tibblify.R
243 lines (235 loc) · 6.78 KB
/
03-issues-tibblify.R
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
source("00-global.R")
issues <- qs::qread("01-issues.qs")
issues_comments <- qs::qread("02-issues-comments.qs")
# issue_specs <-
# issues |>
# map(tibblify::guess_tspec)
#
# tibblify::tspec_combine(!!!issue_specs) |>
# print() |>
# capture.output() |>
# clipr::write_clip()
issue_spec <- tspec_df(
issue_url = tib_chr("url"),
tib_chr("repository_url"),
tib_chr("labels_url"),
tib_chr("comments_url"),
tib_chr("events_url"),
issue_html_url = tib_chr("html_url"),
tib_dbl("id"),
tib_chr("node_id"),
tib_int("number"),
tib_chr("title"),
tib_row(
"user",
tib_chr("login"),
tib_dbl("id"),
tib_chr("node_id"),
tib_chr("avatar_url"),
tib_chr("gravatar_id"),
tib_chr("url"),
tib_chr("html_url"),
tib_chr("followers_url"),
tib_chr("following_url"),
tib_chr("gists_url"),
tib_chr("starred_url"),
tib_chr("subscriptions_url"),
tib_chr("organizations_url"),
tib_chr("repos_url"),
tib_chr("events_url"),
tib_chr("received_events_url"),
tib_chr("type"),
tib_lgl("site_admin"),
),
tib_df(
"labels",
tib_dbl("id", required = FALSE),
tib_chr("node_id", required = FALSE),
tib_chr("url", required = FALSE),
tib_chr("name", required = FALSE),
tib_chr("color", required = FALSE),
tib_lgl("default", required = FALSE),
tib_chr("description", required = FALSE),
),
tib_chr("state"),
tib_lgl("locked"),
tib_row(
"assignee",
tib_chr("login", required = FALSE),
tib_dbl("id", required = FALSE),
tib_chr("node_id", required = FALSE),
tib_chr("avatar_url", required = FALSE),
tib_chr("gravatar_id", required = FALSE),
tib_chr("url", required = FALSE),
tib_chr("html_url", required = FALSE),
tib_chr("followers_url", required = FALSE),
tib_chr("following_url", required = FALSE),
tib_chr("gists_url", required = FALSE),
tib_chr("starred_url", required = FALSE),
tib_chr("subscriptions_url", required = FALSE),
tib_chr("organizations_url", required = FALSE),
tib_chr("repos_url", required = FALSE),
tib_chr("events_url", required = FALSE),
tib_chr("received_events_url", required = FALSE),
tib_chr("type", required = FALSE),
tib_lgl("site_admin", required = FALSE),
),
tib_df(
"assignees",
tib_chr("login", required = FALSE),
tib_dbl("id", required = FALSE),
tib_chr("node_id", required = FALSE),
tib_chr("avatar_url", required = FALSE),
tib_chr("gravatar_id", required = FALSE),
tib_chr("url", required = FALSE),
tib_chr("html_url", required = FALSE),
tib_chr("followers_url", required = FALSE),
tib_chr("following_url", required = FALSE),
tib_chr("gists_url", required = FALSE),
tib_chr("starred_url", required = FALSE),
tib_chr("subscriptions_url", required = FALSE),
tib_chr("organizations_url", required = FALSE),
tib_chr("repos_url", required = FALSE),
tib_chr("events_url", required = FALSE),
tib_chr("received_events_url", required = FALSE),
tib_chr("type", required = FALSE),
tib_lgl("site_admin", required = FALSE),
),
tib_row(
"milestone",
tib_chr("url", required = FALSE),
tib_chr("html_url", required = FALSE),
tib_chr("labels_url", required = FALSE),
tib_dbl("id", required = FALSE),
tib_chr("node_id", required = FALSE),
tib_int("number", required = FALSE),
tib_chr("title", required = FALSE),
tib_chr("description", required = FALSE),
tib_row(
"creator",
.required = FALSE,
tib_chr("login"),
tib_dbl("id"),
tib_chr("node_id"),
tib_chr("avatar_url"),
tib_chr("gravatar_id"),
tib_chr("url"),
tib_chr("html_url"),
tib_chr("followers_url"),
tib_chr("following_url"),
tib_chr("gists_url"),
tib_chr("starred_url"),
tib_chr("subscriptions_url"),
tib_chr("organizations_url"),
tib_chr("repos_url"),
tib_chr("events_url"),
tib_chr("received_events_url"),
tib_chr("type"),
tib_lgl("site_admin"),
),
tib_int("open_issues", required = FALSE),
tib_int("closed_issues", required = FALSE),
tib_chr("state", required = FALSE),
tib_chr("created_at", required = FALSE),
tib_chr("updated_at", required = FALSE),
tib_chr("due_on", required = FALSE),
tib_chr("closed_at", required = FALSE),
),
tib_int("comments"),
issue_created_at = tib_chr_datetime("created_at"),
issue_updated_at = tib_chr_datetime("updated_at"),
issue_closed_at = tib_chr_datetime("closed_at"),
issue_author_association = tib_chr("author_association"),
tib_chr("active_lock_reason"),
tib_chr("body"),
tib_row(
"reactions",
tib_chr("url"),
tib_int("total_count"),
tib_int("+1"),
tib_int("-1"),
tib_int("laugh"),
tib_int("hooray"),
tib_int("confused"),
tib_int("heart"),
tib_int("rocket"),
tib_int("eyes"),
),
tib_chr("timeline_url"),
tib_unspecified("performed_via_github_app"),
tib_chr("state_reason"),
tib_lgl("draft", required = FALSE),
tib_row(
"pull_request",
.required = FALSE,
tib_chr("url", required = FALSE),
tib_chr("html_url", required = FALSE),
tib_chr("diff_url", required = FALSE),
tib_chr("patch_url", required = FALSE),
tib_chr("merged_at", required = FALSE),
),
)
issues_tbl <-
issues |>
map(tibblify::tibblify, spec = issue_spec, unspecified = "drop") |>
bind_rows(.id = "repo")
# comment_specs <-
# comments |>
# map(tibblify::guess_tspec)
#
# tibblify::tspec_combine(!!!comment_specs) |>
# print() |>
# capture.output() |>
# clipr::write_clip()
comments_spec <- tspec_df(
tib_chr("url"),
tib_chr("html_url"),
tib_chr("issue_url"),
tib_dbl("id"),
tib_chr("node_id"),
tib_row(
"user",
tib_chr("login"),
tib_dbl("id"),
tib_chr("node_id"),
tib_chr("avatar_url"),
tib_chr("gravatar_id"),
tib_chr("url"),
tib_chr("html_url"),
tib_chr("followers_url"),
tib_chr("following_url"),
tib_chr("gists_url"),
tib_chr("starred_url"),
tib_chr("subscriptions_url"),
tib_chr("organizations_url"),
tib_chr("repos_url"),
tib_chr("events_url"),
tib_chr("received_events_url"),
tib_chr("type"),
tib_lgl("site_admin"),
),
tib_chr_datetime("created_at"),
tib_chr_datetime("updated_at"),
tib_chr("author_association"),
tib_chr("body"),
tib_row(
"reactions",
tib_chr("url"),
tib_int("total_count"),
tib_int("+1"),
tib_int("-1"),
tib_int("laugh"),
tib_int("hooray"),
tib_int("confused"),
tib_int("heart"),
tib_int("rocket"),
tib_int("eyes"),
),
tib_unspecified("performed_via_github_app"),
)
issues_comments_tbl <-
issues_comments |>
map(tibblify::tibblify, spec = comments_spec, unspecified = "drop") |>
bind_rows(.id = "repo")
qs::qsave(issues_tbl, "03-issues_tbl.qs")
qs::qsave(issues_comments_tbl, "03-issues_comments_tbl.qs")