You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/10/12 13:29:36 UTC

[skywalking-website] branch master updated: Check contributors graph data (#516)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 5362719265 Check contributors graph data (#516)
5362719265 is described below

commit 53627192657ba66de803651e4bd90c71e64aa866
Author: Juntao Zhang <71...@qq.com>
AuthorDate: Wed Oct 12 21:29:31 2022 +0800

    Check contributors graph data (#516)
---
 scripts/team.js | 51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/scripts/team.js b/scripts/team.js
index d73dfd7e51..55876e8aca 100644
--- a/scripts/team.js
+++ b/scripts/team.js
@@ -54,21 +54,50 @@ class GenerateTeamYaml {
   }
 
   async getMergedData({user, repo}) {
+    const that = this;
+    let count = 0;
+    const NUM = 10;
+    const FAIL_TIPS = `${user}/${repo}/graphs failed!`;
+
     try {
-      const res = await axios.get(`https://github.com/${user}/${repo}/graphs/contributors-data`, {
-        headers: {
-          'accept': 'application/json',
-          'User-Agent': '',
-        },
-      });
-      const source = res && res.data || [];
-      source.repo = repo;
-      this.mergedData.push(source);
-      console.log(`${user}/${repo}/graphs success!`);
+      await getContributionsGraphs()
     } catch (e) {
-      console.log(`${user}/${repo}/graphs failed!`);
+      console.log(FAIL_TIPS);
       process.exit(1)
     }
+
+    async function getContributionsGraphs() {
+      ++count;
+      if (count > 1) {
+        console.log(`${user}/${repo}: retry ${count} ...`);
+      }
+      try {
+        const res = await axios.get(`https://github.com/${user}/${repo}/graphs/contributors-data`, {
+          headers: {
+            'accept': 'application/json',
+            'User-Agent': '',
+          },
+        });
+        const {status, data: source = []} = res
+        if (status === 200 && source.length) {
+          source.repo = repo;
+          that.mergedData.push(source);
+          console.log(`${user}/${repo}/graphs success!`);
+        } else {
+          console.log(`${user}/${repo}/graphs: res.status ${status}!`);
+          if (count < NUM) {
+            await sleep(1000)
+            await getContributionsGraphs()
+          }
+
+        }
+      } catch (e) {
+        console.log(`${user}/${repo}/`, e);
+        if (count < NUM) {
+          await getContributionsGraphs()
+        }
+      }
+    }
   }
 
   buildMergedData(sources) {