File tree Expand file tree Collapse file tree 5 files changed +347
-183
lines changed
GetAllRepositoriesForOrganization Expand file tree Collapse file tree 5 files changed +347
-183
lines changed Original file line number Diff line number Diff line change 1
- const octokit = require ( '@octokit/rest' ) ( {
2
- headers : {
3
- 'user-agent' : 'FanOutFanInCrawler'
4
- }
5
- } )
6
- octokit . authenticate ( {
7
- type : 'token' ,
8
- token : process . env [ 'GitHubToken' ]
9
- } )
1
+ const { Octokit } = require ( '@octokit/rest' ) ;
10
2
11
- module . exports = async function ( context ) {
3
+ const octokit = new Octokit ( {
4
+ userAgent : 'FanOutFanInCrawler' ,
5
+ auth : `token ${ process . env [ 'GitHubToken' ] } `
6
+ } ) ;
7
+
8
+ module . exports = async function ( context ) {
12
9
// retrieves the organization name from the Orchestrator function
13
10
var organizationName = context . bindings . input ;
14
11
15
12
var finalResult = [ ]
16
13
let page = 1
17
14
do {
18
15
// invoke the API to retrieve the list of repositories of a specific organization
19
- var result = await octokit . repos . getForOrg ( {
16
+ var result = await octokit . repos . listForOrg ( {
20
17
org : organizationName ,
21
18
type : 'public' ,
22
19
page : page
@@ -26,5 +23,5 @@ module.exports = async function(context) {
26
23
finalResult = finalResult . concat ( result . data )
27
24
} while ( result . data . length !== 0 )
28
25
29
- context . done ( null , finalResult ) ;
26
+ context . done ( null , finalResult ) ;
30
27
}
Original file line number Diff line number Diff line change 1
1
const df = require ( 'durable-functions' )
2
- const octokit = require ( '@octokit/rest' ) ( {
3
- headers : {
4
- 'user-agent' : 'FanOutFanInCrawler'
5
- }
6
- } )
7
- octokit . authenticate ( {
8
- type : 'token' ,
9
- token : process . env [ 'GitHubToken' ]
10
- } )
2
+ const { Octokit } = require ( '@octokit/rest' ) ;
3
+
4
+ const octokit = new Octokit ( {
5
+ userAgent : 'FanOutFanInCrawler' ,
6
+ auth : `token ${ process . env [ 'GitHubToken' ] } `
7
+ } ) ;
11
8
12
9
module . exports = async function ( context ) {
13
10
// `input` here is retrieved from the Orchestrator function `callActivity` input parameter
@@ -18,7 +15,7 @@ module.exports = async function(context) {
18
15
19
16
do {
20
17
// retrieves a list of open issues from a specific repository
21
- var result = await octokit . issues . getForRepo ( {
18
+ var result = await octokit . issues . listForRepo ( {
22
19
owner : input . owner . login ,
23
20
repo : input . name ,
24
21
state : 'open' ,
Original file line number Diff line number Diff line change 4
4
"FUNCTIONS_WORKER_RUNTIME" : " node" ,
5
5
"AzureWebJobsStorage" : " UseDevelopmentStorage=true" ,
6
6
"AzureWebJobsDashboard" : " UseDevelopmentStorage=true" ,
7
- "AzureWebJobsSecretStorageType " : " files " ,
7
+ "FUNCTIONS_V2_COMPATIBILITY_MODE " : true ,
8
8
"GitHubToken" : " YOUR TOKEN HERE"
9
9
}
10
10
}
You can’t perform that action at this time.
0 commit comments