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/02/19 13:46:05 UTC

[skywalking-website] branch master updated: Add extra contributors (#401)

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 67411d4  Add extra contributors (#401)
67411d4 is described below

commit 67411d4e04693dca80e5a01cb90a06fb99179962
Author: Juntao Zhang <71...@qq.com>
AuthorDate: Sat Feb 19 21:45:59 2022 +0800

    Add extra contributors (#401)
---
 data/docs.yml   |  4 ++++
 scripts/team.js | 22 +++++++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/data/docs.yml b/data/docs.yml
index fe813dc..9e32d9e 100644
--- a/data/docs.yml
+++ b/data/docs.yml
@@ -21,6 +21,10 @@
       user: apache
       repo: skywalking
       repoUrl: https://github.com/apache/skywalking.git
+      extraContributors:
+        - login: Adrian Cole
+        - login: github-actions[bot]
+        - login: dependabot[bot]
       docs:
         - version: latest
           link: /docs/main/latest/readme/
diff --git a/scripts/team.js b/scripts/team.js
index 6830736..81615a4 100644
--- a/scripts/team.js
+++ b/scripts/team.js
@@ -36,10 +36,10 @@ class GenerateTeamYaml {
     const mergedPromiseList = [];
     for (const k of this.nativeObject) {
       for (const item of k.list) {
-        const {user, repo} = item;
+        const {user, repo, extraContributors} = item;
         const list = [];
         if (user && repo) {
-          promiseList.push(this.getRepoContributors({user, repo, list, item}));
+          promiseList.push(this.getRepoContributors({user, repo, extraContributors, list, item}));
           mergedPromiseList.push(this.getMergedData({user, repo}));
         }
       }
@@ -71,7 +71,7 @@ class GenerateTeamYaml {
     const date = [];
 
     const x = new Date();
-    const timepoint = x.setFullYear(2021,7,25);
+    const timepoint = x.setFullYear(2021, 7, 25);
 
     for (let i = 0; i < maxWeekLen; i++) {
       let num = 0;
@@ -152,16 +152,20 @@ class GenerateTeamYaml {
         });
   }
 
-  async getRepoContributors({user, repo, page = 1, per_page = 100, list = [], item}) {
-    let {data} = await axios.get(`https://api.github.com/repos/${user}/${repo}/contributors?page=${page}&per_page=${per_page}&anon=true&t=${new Date().getTime()}`)
+  async getRepoContributors({user, repo, extraContributors = [], page = 1, per_page = 100, list = [], item}) {
+    let {data = []} = await axios.get(`https://api.github.com/repos/${user}/${repo}/contributors?page=${page}&per_page=${per_page}&anon=true&t=${new Date().getTime()}`)
     data = this.handleData(data);
-    list.push(...data)
+    list.push(...data);
     if (data.length === per_page) {
       page++;
-      await this.getRepoContributors({user, repo, page, per_page, list, item})
+      await this.getRepoContributors({user, repo, extraContributors, page, per_page, list, item})
     } else {
-      item.contributors = list;
-      item.contributorCount = [...new Set(list.map(item => item.id || item.email))].length;
+      if (extraContributors && extraContributors.length) {
+        extraContributors.forEach(item => this.logins[item.login] = item.login);
+      }
+      const repoContributors = [...list, ...extraContributors];
+      item.contributors = repoContributors;
+      item.contributorCount = [...new Set(repoContributors.map(item => item.id || item.login))].length;
     }
   }
 }