Skip to content

Commit d16dba3

Browse files
committed
updating packages versions. adding compatibility mode.
1 parent 3c7765c commit d16dba3

File tree

5 files changed

+347
-183
lines changed

5 files changed

+347
-183
lines changed
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
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');
102

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) {
129
// retrieves the organization name from the Orchestrator function
1310
var organizationName = context.bindings.input;
1411

1512
var finalResult = []
1613
let page = 1
1714
do {
1815
// 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({
2017
org: organizationName,
2118
type: 'public',
2219
page: page
@@ -26,5 +23,5 @@ module.exports = async function(context) {
2623
finalResult = finalResult.concat(result.data)
2724
} while (result.data.length !== 0)
2825

29-
context.done(null, finalResult);
26+
context.done(null, finalResult);
3027
}

FanOutFanInCrawler/GetOpenedIssues/index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
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+
});
118

129
module.exports = async function(context) {
1310
// `input` here is retrieved from the Orchestrator function `callActivity` input parameter
@@ -18,7 +15,7 @@ module.exports = async function(context) {
1815

1916
do {
2017
// retrieves a list of open issues from a specific repository
21-
var result = await octokit.issues.getForRepo({
18+
var result = await octokit.issues.listForRepo({
2219
owner: input.owner.login,
2320
repo: input.name,
2421
state: 'open',

FanOutFanInCrawler/local.settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"FUNCTIONS_WORKER_RUNTIME": "node",
55
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
66
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
7-
"AzureWebJobsSecretStorageType": "files",
7+
"FUNCTIONS_V2_COMPATIBILITY_MODE": true,
88
"GitHubToken": "YOUR TOKEN HERE"
99
}
1010
}

0 commit comments

Comments
 (0)