@@ -25,17 +25,19 @@ export async function searchIssuesAndPRs(octokit, owner, repo, query, perPage =
25
25
26
26
try {
27
27
const gptscriptClient = new GPTScript ( ) ;
28
- const dataset = await gptscriptClient . createDataset ( process . env . GPTSCRIPT_WORKSPACE_ID , `${ query } _github_issues_prs` , `Search results for ${ query } on GitHub` ) ;
29
28
const elements = items . map ( issue => {
30
29
return {
31
- name : issue . id ,
30
+ name : ` ${ issue . id } ` ,
32
31
description : '' ,
33
- contents : Buffer . from ( `#${ issue . number } - ${ issue . title } (ID: ${ issue . id } ) - ${ issue . html_url } ` )
32
+ contents : `#${ issue . number } - ${ issue . title } (ID: ${ issue . id } ) - ${ issue . html_url } `
34
33
}
35
34
} ) ;
36
- await gptscriptClient . addDatasetElements ( process . env . GPTSCRIPT_WORKSPACE_ID , dataset . id , elements ) ;
35
+ const datasetID = await gptscriptClient . addDatasetElements ( elements , {
36
+ name : `${ query } _github_issues_prs` ,
37
+ description : `Search results for ${ query } on GitHub`
38
+ } )
37
39
38
- console . log ( `Created dataset with ID ${ dataset . id } with ${ elements . length } results` ) ;
40
+ console . log ( `Created dataset with ID ${ datasetID } with ${ elements . length } results` ) ;
39
41
} catch ( e ) {
40
42
console . log ( 'Failed to create dataset:' , e )
41
43
}
@@ -93,21 +95,18 @@ export async function listIssueComments(octokit, owner, repo, issueNumber) {
93
95
94
96
try {
95
97
const gptscriptClient = new GPTScript ( ) ;
96
- const dataset = await gptscriptClient . createDataset (
97
- process . env . GPTSCRIPT_WORKSPACE_ID ,
98
- `${ owner } _${ repo } _issue_${ issueNumber } _comments` ,
99
- `Comments for issue #${ issueNumber } in ${ owner } /${ repo } `
100
- ) ;
101
98
const elements = data . map ( comment => {
102
99
return {
103
- name : comment . id ,
100
+ name : ` ${ comment . id } ` ,
104
101
description : '' ,
105
- contents : Buffer . from ( `Comment by ${ comment . user . login } : ${ comment . body } - https://github.com/${ owner } /${ repo } /issues/${ issueNumber } #issuecomment-${ comment . id } ` )
102
+ contents : `Comment by ${ comment . user . login } : ${ comment . body } - https://github.com/${ owner } /${ repo } /issues/${ issueNumber } #issuecomment-${ comment . id } `
106
103
}
107
104
} ) ;
108
- await gptscriptClient . addDatasetElements ( process . env . GPTSCRIPT_WORKSPACE_ID , dataset . id , elements ) ;
109
-
110
- console . log ( `Created dataset with ID ${ dataset . id } with ${ elements . length } comments` ) ;
105
+ const datasetID = await gptscriptClient . addDatasetElements ( elements , {
106
+ name : `${ owner } _${ repo } _issue_${ issueNumber } _comments` ,
107
+ description : `Comments for issue #${ issueNumber } in ${ owner } /${ repo } `
108
+ } )
109
+ console . log ( `Created dataset with ID ${ datasetID } with ${ elements . length } comments` ) ;
111
110
} catch ( e ) {
112
111
console . log ( 'Failed to create dataset:' , e ) ;
113
112
}
@@ -179,21 +178,18 @@ export async function listPRComments(octokit, owner, repo, prNumber) {
179
178
180
179
try {
181
180
const gptscriptClient = new GPTScript ( ) ;
182
- const dataset = await gptscriptClient . createDataset (
183
- process . env . GPTSCRIPT_WORKSPACE_ID ,
184
- `${ owner } _${ repo } _pr_${ prNumber } _comments` ,
185
- `Comments for PR #${ prNumber } in ${ owner } /${ repo } `
186
- ) ;
187
181
const elements = data . map ( comment => {
188
182
return {
189
- name : comment . id ,
183
+ name : ` ${ comment . id } ` ,
190
184
description : '' ,
191
- contents : Buffer . from ( `Comment by ${ comment . user . login } : ${ comment . body } - https://github.com/${ owner } /${ repo } /pull/${ prNumber } #issuecomment-${ comment . id } ` )
185
+ contents : `Comment by ${ comment . user . login } : ${ comment . body } - https://github.com/${ owner } /${ repo } /pull/${ prNumber } #issuecomment-${ comment . id } `
192
186
}
193
187
} ) ;
194
- await gptscriptClient . addDatasetElements ( process . env . GPTSCRIPT_WORKSPACE_ID , dataset . id , elements ) ;
195
-
196
- console . log ( `Created dataset with ID ${ dataset . id } with ${ elements . length } comments` ) ;
188
+ const datasetID = await gptscriptClient . addDatasetElements ( elements , {
189
+ name : `${ owner } _${ repo } _pr_${ prNumber } _comments` ,
190
+ description : `Comments for PR #${ prNumber } in ${ owner } /${ repo } `
191
+ } )
192
+ console . log ( `Created dataset with ID ${ datasetID } with ${ elements . length } comments` ) ;
197
193
} catch ( e ) {
198
194
console . log ( 'Failed to create dataset:' , e ) ;
199
195
}
@@ -219,22 +215,18 @@ export async function listRepos(octokit, owner) {
219
215
220
216
try {
221
217
const gptscriptClient = new GPTScript ( ) ;
222
- const dataset = await gptscriptClient . createDataset (
223
- process . env . GPTSCRIPT_WORKSPACE_ID ,
224
- `${ owner } _github_repos` ,
225
- `GitHub repos for ${ owner } `
226
- ) ;
227
-
228
218
const elements = repos . data . map ( repo => {
229
219
return {
230
- name : repo . id ,
220
+ name : ` ${ repo . id } ` ,
231
221
description : '' ,
232
- contents : Buffer . from ( `${ repo . name } (ID: ${ repo . id } ) - https://github.com/${ owner } /${ repo . name } ` )
222
+ contents : `${ repo . name } (ID: ${ repo . id } ) - https://github.com/${ owner } /${ repo . name } `
233
223
}
234
224
} ) ;
235
- await gptscriptClient . addDatasetElements ( process . env . GPTSCRIPT_WORKSPACE_ID , dataset . id , elements ) ;
236
-
237
- console . log ( `Created dataset with ID ${ dataset . id } with ${ elements . length } repositories` ) ;
225
+ const datasetID = await gptscriptClient . addDatasetElements ( elements , {
226
+ name : `${ owner } _github_repos` ,
227
+ description : `GitHub repos for ${ owner } `
228
+ } )
229
+ console . log ( `Created dataset with ID ${ datasetID } with ${ elements . length } repositories` ) ;
238
230
} catch ( e ) {
239
231
console . log ( 'Failed to create dataset:' , e ) ;
240
232
}
0 commit comments