Skip to content

Commit e862e44

Browse files
sdrasMaximRouiller
authored andcommitted
update formatting
1 parent 4b3a12a commit e862e44

File tree

11 files changed

+133
-123
lines changed

11 files changed

+133
-123
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"bindings": [{
3-
"name": "input",
4-
"type": "activityTrigger",
5-
"direction": "in"
6-
}],
2+
"bindings": [
3+
{
4+
"name": "input",
5+
"type": "activityTrigger",
6+
"direction": "in"
7+
}
8+
],
79
"disabled": false
8-
}
10+
}
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
const octokit = require('@octokit/rest')({
2-
headers: {
3-
'user-agent': 'FanOutFanInCrawler'
4-
}
5-
});
2+
headers: {
3+
'user-agent': 'FanOutFanInCrawler'
4+
}
5+
})
66
octokit.authenticate({
7-
type: 'token',
8-
token: process.env["GitHubToken"]
9-
});
7+
type: 'token',
8+
token: process.env['GitHubToken']
9+
})
1010

11-
module.exports = async function (context, input) {
12-
// retrieves the organization name from the Orchestrator function
13-
var organizationName = input;
11+
module.exports = async function(context, input) {
12+
// retrieves the organization name from the Orchestrator function
13+
var organizationName = input
1414

15-
var finalResult = [];
16-
let page = 1;
17-
do {
18-
// invoke the API to retrieve the list of repositories of a specific organization
19-
var result = await octokit.repos.getForOrg({
20-
org: organizationName,
21-
type: "public",
22-
page: page
23-
});
24-
page++;
25-
// merge the paged results inside a single array
26-
finalResult = finalResult.concat(result.data);
27-
}
28-
while (result.data.length !== 0)
29-
return finalResult;
30-
};
15+
var finalResult = []
16+
let page = 1
17+
do {
18+
// invoke the API to retrieve the list of repositories of a specific organization
19+
var result = await octokit.repos.getForOrg({
20+
org: organizationName,
21+
type: 'public',
22+
page: page
23+
})
24+
page++
25+
// merge the paged results inside a single array
26+
finalResult = finalResult.concat(result.data)
27+
} while (result.data.length !== 0)
28+
return finalResult
29+
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"bindings": [{
3-
"name": "input",
4-
"type": "activityTrigger",
5-
"direction": "in"
6-
}],
2+
"bindings": [
3+
{
4+
"name": "input",
5+
"type": "activityTrigger",
6+
"direction": "in"
7+
}
8+
],
79
"disabled": false
8-
}
10+
}
Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
const df = require("durable-functions");
1+
const df = require('durable-functions')
22
const octokit = require('@octokit/rest')({
3-
headers: {
4-
'user-agent': 'FanOutFanInCrawler'
5-
}
6-
});
3+
headers: {
4+
'user-agent': 'FanOutFanInCrawler'
5+
}
6+
})
77
octokit.authenticate({
8-
type: 'token',
9-
token: process.env["GitHubToken"]
10-
});
8+
type: 'token',
9+
token: process.env['GitHubToken']
10+
})
1111

12-
module.exports = async function (context, input) {
13-
// `input` here is retrieved from the Orchestrator function `callActivityAsync` input parameter
12+
module.exports = async function(context, input) {
13+
// `input` here is retrieved from the Orchestrator function `callActivityAsync` input parameter
1414

15-
let page = 1
16-
let issueCount = 0;
15+
let page = 1
16+
let issueCount = 0
1717

18-
do {
19-
// retrieves a list of open issues from a specific repository
20-
var result = await octokit.issues.getForRepo({
21-
owner: input.owner.login,
22-
repo: input.name,
23-
state: 'open',
24-
per_page: 100,
25-
page: page
26-
});
27-
page++;
28-
// aggregate the result
29-
issueCount += result.data.length;
30-
}
31-
while (result.data.length !== 0)
18+
do {
19+
// retrieves a list of open issues from a specific repository
20+
var result = await octokit.issues.getForRepo({
21+
owner: input.owner.login,
22+
repo: input.name,
23+
state: 'open',
24+
per_page: 100,
25+
page: page
26+
})
27+
page++
28+
// aggregate the result
29+
issueCount += result.data.length
30+
} while (result.data.length !== 0)
3231

33-
// returns an object with the count of opened issues for a specific repository
34-
return {id: input.id, openedIssues: issueCount, name: input.name };
35-
};
32+
// returns an object with the count of opened issues for a specific repository
33+
return { id: input.id, openedIssues: issueCount, name: input.name }
34+
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"bindings": [{
3-
"name": "context",
4-
"type": "orchestrationTrigger",
5-
"direction": "in"
6-
}],
2+
"bindings": [
3+
{
4+
"name": "context",
5+
"type": "orchestrationTrigger",
6+
"direction": "in"
7+
}
8+
],
79
"disabled": false
8-
}
10+
}
Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
const df = require("durable-functions");
1+
const df = require('durable-functions')
22

3-
module.exports = df(function* (context) {
4-
// retrieves the organization name from the Orchestrator_HttpStart function
5-
var organizationName = context.df.getInput();
6-
// retrieves the list of repositories for an organization by invoking a separate Activity Function.
7-
var repositories = yield context.df.callActivityAsync("GetAllRepositoriesForOrganization", organizationName);
3+
module.exports = df(function*(context) {
4+
// retrieves the organization name from the Orchestrator_HttpStart function
5+
var organizationName = context.df.getInput()
6+
// retrieves the list of repositories for an organization by invoking a separate Activity Function.
7+
var repositories = yield context.df.callActivityAsync(
8+
'GetAllRepositoriesForOrganization',
9+
organizationName
10+
)
811

9-
// Creates an array of task to store the result of each functions
10-
var output = [];
11-
for (var i = 0; i < repositories.length; i++) {
12-
// Starting a `GetOpenedIssues` activity WITHOUT `yield`
13-
// This will starts Activity Functions in parallel instead of sequentially.
14-
output.push(context.df.callActivityAsync("GetOpenedIssues", repositories[i]));
15-
}
12+
// Creates an array of task to store the result of each functions
13+
var output = []
14+
for (var i = 0; i < repositories.length; i++) {
15+
// Starting a `GetOpenedIssues` activity WITHOUT `yield`
16+
// This will starts Activity Functions in parallel instead of sequentially.
17+
output.push(
18+
context.df.callActivityAsync('GetOpenedIssues', repositories[i])
19+
)
20+
}
1621

17-
// Wait for all Activity Functions to complete execution
18-
const results = yield context.df.Task.all(output);
22+
// Wait for all Activity Functions to complete execution
23+
const results = yield context.df.Task.all(output)
1924

20-
// Send the list to an Activity Function to save them to Blob Storage.
21-
yield context.df.callActivityAsync("SaveRepositories", results);
25+
// Send the list to an Activity Function to save them to Blob Storage.
26+
yield context.df.callActivityAsync('SaveRepositories', results)
2227

23-
return context.instanceId;
24-
});
28+
return context.instanceId
29+
})

FanOutFanInCrawler/Orchestrator_HttpStart/function.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
"type": "httpTrigger",
77
"direction": "in",
88
"name": "req",
9-
"methods": [
10-
"get",
11-
"post"
12-
]
9+
"methods": ["get", "post"]
1310
},
1411
{
1512
"type": "http",
@@ -22,4 +19,4 @@
2219
"direction": "out"
2320
}
2421
]
25-
}
22+
}
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
const uuid = require('uuid/v4');
1+
const uuid = require('uuid/v4')
22

3-
module.exports = function (context, req, starter) {
4-
var id = uuid();
5-
6-
// Function input comes from the request content.
7-
context.bindings.starter = [{
8-
FunctionName: "Orchestrator",
9-
Input: "Nuget",
10-
InstanceId: id
11-
}];
12-
13-
context.done(null);
14-
};
3+
module.exports = function(context, req, starter) {
4+
var id = uuid()
5+
6+
// Function input comes from the request content.
7+
context.bindings.starter = [
8+
{
9+
FunctionName: 'Orchestrator',
10+
Input: 'Nuget',
11+
InstanceId: id
12+
}
13+
]
14+
15+
context.done(null)
16+
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"bindings": [{
3-
"name": "input",
4-
"type": "activityTrigger",
5-
"direction": "in"
6-
}],
2+
"bindings": [
3+
{
4+
"name": "input",
5+
"type": "activityTrigger",
6+
"direction": "in"
7+
}
8+
],
79
"disabled": false
8-
}
10+
}

FanOutFanInCrawler/host.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"version": "2.0",
33
"logging": {
4-
"LogLevel": {
4+
"LogLevel": {
55
"Default": "Trace"
66
}
77
}
8-
}
8+
}

0 commit comments

Comments
 (0)