@@ -9,10 +9,10 @@ const GH_TOKEN = core.getInput('github-token') || process.env.GH_TOKEN;
9
9
const octokit = createOctokit ( {
10
10
DEFAULT_ORG ,
11
11
accessToken : GH_TOKEN ,
12
- cacheKey : ''
12
+ cacheKey : '' ,
13
13
} ) ;
14
14
15
- const fetchContributorStats = async function ( owner , repo ) {
15
+ const fetchContributorStats = async function ( owner , repo ) {
16
16
// console.log("creating octokit")
17
17
// const octokit = await createGithubClient(DEFAULT_ORG, '', token)
18
18
// console.log("octokit created", octokit);
@@ -23,7 +23,7 @@ const fetchContributorStats = async function(owner, repo) {
23
23
'GET /repos/:owner/:repo/stats/contributors' ,
24
24
{
25
25
owner,
26
- repo
26
+ repo,
27
27
}
28
28
) ;
29
29
// console.log(`Result: ${contributorStats}`);
@@ -44,9 +44,11 @@ const fetchRepoStatsByContributor_withRetry = async (owner, repo, retries) => {
44
44
} catch ( err ) {
45
45
error = err ;
46
46
prettyPrint (
47
- `[WARNING] at stats-generator.github.fetchContributorStats.fetchRepoStatsByContributor_withRetry \n | Try #${ i +
48
- 1 } | owner: ${ owner } , repo: ${ repo } | getRepoStatsByContributor failed, retrying after ${ delay /
49
- 1000 } s delay\n`
47
+ `[WARNING] at stats-generator.github.fetchContributorStats.fetchRepoStatsByContributor_withRetry \n | Try #${
48
+ i + 1
49
+ } | owner: ${ owner } , repo: ${ repo } | getRepoStatsByContributor failed, retrying after ${
50
+ delay / 1000
51
+ } s delay\n`
50
52
) ;
51
53
await sleep ( delay ) ;
52
54
}
@@ -56,14 +58,14 @@ const fetchRepoStatsByContributor_withRetry = async (owner, repo, retries) => {
56
58
return null ;
57
59
} ;
58
60
59
- const getRepoStatsByContributor = async function ( owner , repo ) {
61
+ const getRepoStatsByContributor = async function ( owner , repo ) {
60
62
const response = await fetchContributorStats ( owner , repo ) ;
61
63
const { /* status, url, headers, */ data } = response ;
62
64
63
65
if ( Array . isArray ( data ) ) {
64
66
const formattedContributorStats = data . map ( ( { total, author } ) => ( {
65
67
total : total ,
66
- author : author
68
+ author : author ,
67
69
} ) ) ;
68
70
return formattedContributorStats ;
69
71
}
@@ -74,7 +76,7 @@ const getRepoStatsByContributor = async function(owner, repo) {
74
76
) ;
75
77
} ;
76
78
77
- const fetchStats = async function ( owner , repo ) {
79
+ const fetchStats = async function ( owner , repo ) {
78
80
const retries = 3 ;
79
81
const contributorStats = await fetchRepoStatsByContributor_withRetry (
80
82
owner ,
@@ -90,5 +92,5 @@ const fetchStats = async function(owner, repo) {
90
92
// })();
91
93
92
94
module . exports = {
93
- fetchStats
95
+ fetchStats,
94
96
} ;
0 commit comments