diff options
Diffstat (limited to 'scripts/generate-code-contributors.ts')
-rwxr-xr-x | scripts/generate-code-contributors.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.ts index 3d37372d1..96110307a 100755 --- a/scripts/generate-code-contributors.ts +++ b/scripts/generate-code-contributors.ts | |||
@@ -41,7 +41,7 @@ async function run () { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | function get (url: string, headers: any = {}) { | 43 | function get (url: string, headers: any = {}) { |
44 | return doRequest({ | 44 | return doRequest<any>({ |
45 | uri: url, | 45 | uri: url, |
46 | json: true, | 46 | json: true, |
47 | headers: Object.assign(headers, { | 47 | headers: Object.assign(headers, { |
@@ -70,11 +70,17 @@ async function fetchGithub (url: string) { | |||
70 | 70 | ||
71 | async function fetchZanata (zanataUsername: string, zanataPassword: string) { | 71 | async function fetchZanata (zanataUsername: string, zanataPassword: string) { |
72 | const today = new Date().toISOString().split('T')[0] | 72 | const today = new Date().toISOString().split('T')[0] |
73 | const url = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..${today}` | 73 | const year2018 = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..2019-01-01` |
74 | const year2019 = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2019-01-01..${today}` | ||
74 | 75 | ||
75 | const headers = { | 76 | const headers = { |
76 | 'X-Auth-User': zanataUsername, | 77 | 'X-Auth-User': zanataUsername, |
77 | 'X-Auth-Token': zanataPassword | 78 | 'X-Auth-Token': zanataPassword |
78 | } | 79 | } |
79 | return get(url, headers) | 80 | const [ results2018, results2019 ] = await Promise.all([ |
81 | get(year2018, headers), | ||
82 | get(year2019, headers) | ||
83 | ]) | ||
84 | |||
85 | return results2018.concat(results2019) | ||
80 | } | 86 | } |