diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml
new file mode 100644
index 0000000..499f887
--- /dev/null
+++ b/.github/workflows/update.yaml
@@ -0,0 +1,44 @@
+name: update-companies
+on:
+ schedule:
+ # 하루에 한 번, 04:00 UTC => 13:00 (GMT+9)에 업데이트
+ - cron: '0 4 * * *'
+ push:
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ update:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ['3.10']
+ steps:
+ - uses: actions/checkout@master
+ with:
+ persist-credentials: false
+ fetch-depth: 0
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install dependencies (`aiohttp`)
+ run: |
+ python -m pip install --upgrade pip
+ pip install aiohttp
+
+ - name: Run script
+ run: |
+ python3 ./src/update-json.py ${{ secrets.GITHUB_TOKEN }}
+ python3 ./src/update-markdown.py
+
+ - name: Commit & Push changes
+ uses: Andro999b/push@patch-1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ branch: main
+ message: >
+ 🎉 chore: update draws for ${{ env.DATE }}
diff --git a/README.md b/README.md
index 8774a10..225cb5a 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,27 @@
# 국내 IT 기업 소프트웨어 개발 문화
-본 레포지터리는 국내 IT 기업의 소프트웨어 개발 문화에 대한 다양한 자료를 정리하고 있습니다.
+본 레포지터리는 국내 IT 기업의 소프트웨어 개발 문화에 대한 다양한 자료를 정리하고 있습니다.
## 상위 10개 IT 기업 Github 레포지터리 (숫자 기준)
+- 데이터는 매일 오후 1시에 자동으로 업데이트됩니다. `main` 브랜치에 새로운 커밋이 추가되었을 때도 업데이트가 시도됩니다.
+- 전체 목록은 [여기](./github.json)에서 확인하실 수 있습니다.
+
+> **Note**
+> 새로운 회사를 추가하고 싶거나, 오가니제이션 정보 수정이 필요한 경우 [`github.json`](./github.json) 파일을 변경한 뒤에, Pull Request를 올려 주세요.
+
+
+
| **회사명** | **레포지터리 수** | **팔로워 수** | **Github 주소** |
|:---|---:|---:|:---|
-| 티맥스클라우드 | 245 | 15 | https://github.com/tmax-cloud |
-| 네이버 | 214 | 445 | https://github.com/naver |
-| 삼성전자 | 155 | - | https://github.com/Samsung |
-| 센드버드 | 155 | 62 | https://github.com/sendbird |
-| 데브시스터즈 | 150 | 61 | https://github.com/devsisters |
-| 리디 | 123 | 27 | https://github.com/ridi |
-| 라인 | 109 | 297 | https://github.com/line |
-| 당근마켓 | 103 | 271 | https://github.com/daangn |
-| NHN | 103 | 216 | https://github.com/nhn |
-| 래블업 | 101 | 18 | https://github.com/lablup |
+| 티맥스클라우드 | 245 | 17 | https://github.com/tmax-cloud |
+| 네이버 | 214 | 463 | https://github.com/naver |
+| 인베슘 | 163 | 12 | https://github.com/hamonikr |
+| 삼성전자 | 155 | 278 | https://github.com/Samsung |
+| 센드버드 | 155 | 68 | https://github.com/sendbird |
+| 데브시스터즈 | 150 | 69 | https://github.com/devsisters |
+| 리디 | 123 | 29 | https://github.com/ridi |
+| 라인 | 109 | 306 | https://github.com/line |
+| 당근마켓 | 103 | 281 | https://github.com/daangn |
+| NHN | 103 | 224 | https://github.com/nhn |
+
+
diff --git a/github.json b/github.json
new file mode 100644
index 0000000..c63e46f
--- /dev/null
+++ b/github.json
@@ -0,0 +1,602 @@
+[
+ {
+ "name": "티맥스클라우드",
+ "organizations": [
+ [
+ "tmax-cloud",
+ 245,
+ 17
+ ]
+ ]
+ },
+ {
+ "name": "네이버",
+ "organizations": [
+ [
+ "naver",
+ 214,
+ 463
+ ]
+ ]
+ },
+ {
+ "name": "인베슘",
+ "organizations": [
+ [
+ "hamonikr",
+ 163,
+ 12
+ ]
+ ]
+ },
+ {
+ "name": "삼성전자",
+ "organizations": [
+ [
+ "Samsung",
+ 155,
+ 278
+ ]
+ ]
+ },
+ {
+ "name": "센드버드",
+ "organizations": [
+ [
+ "sendbird",
+ 155,
+ 68
+ ]
+ ]
+ },
+ {
+ "name": "데브시스터즈",
+ "organizations": [
+ [
+ "devsisters",
+ 150,
+ 69
+ ]
+ ]
+ },
+ {
+ "name": "리디",
+ "organizations": [
+ [
+ "ridi",
+ 123,
+ 29
+ ]
+ ]
+ },
+ {
+ "name": "라인",
+ "organizations": [
+ [
+ "line",
+ 109,
+ 306
+ ]
+ ]
+ },
+ {
+ "name": "당근마켓",
+ "organizations": [
+ [
+ "daangn",
+ 103,
+ 281
+ ]
+ ]
+ },
+ {
+ "name": "NHN",
+ "organizations": [
+ [
+ "nhn",
+ 103,
+ 224
+ ]
+ ]
+ },
+ {
+ "name": "래블업",
+ "organizations": [
+ [
+ "lablup",
+ 102,
+ 22
+ ]
+ ]
+ },
+ {
+ "name": "하이퍼커넥트",
+ "organizations": [
+ [
+ "hyperconnect",
+ 99,
+ 17
+ ]
+ ]
+ },
+ {
+ "name": "삼성SDS",
+ "organizations": [
+ [
+ "samsung-cnct",
+ 70,
+ 4
+ ],
+ [
+ "SDSACT",
+ 7,
+ 2
+ ],
+ [
+ "samsungsds-rnd",
+ 7,
+ 2
+ ]
+ ]
+ },
+ {
+ "name": "뤼이드",
+ "organizations": [
+ [
+ "riiid",
+ 53,
+ 22
+ ]
+ ]
+ },
+ {
+ "name": "버즈빌",
+ "organizations": [
+ [
+ "Buzzvil",
+ 53,
+ 8
+ ]
+ ]
+ },
+ {
+ "name": "카카오",
+ "organizations": [
+ [
+ "kakao",
+ 50,
+ 158
+ ]
+ ]
+ },
+ {
+ "name": "네이버클라우드",
+ "organizations": [
+ [
+ "NaverCloudPlatform",
+ 40,
+ 22
+ ]
+ ]
+ },
+ {
+ "name": "카카오브레인",
+ "organizations": [
+ [
+ "kakaobrain",
+ 29,
+ 219
+ ]
+ ]
+ },
+ {
+ "name": "그린랩스",
+ "organizations": [
+ [
+ "green-labs",
+ 28,
+ 38
+ ]
+ ]
+ },
+ {
+ "name": "직방",
+ "organizations": [
+ [
+ "zigbang",
+ 26,
+ 21
+ ]
+ ]
+ },
+ {
+ "name": "우아한형제들",
+ "organizations": [
+ [
+ "woowabros",
+ 25,
+ 44
+ ]
+ ]
+ },
+ {
+ "name": "쏘카",
+ "organizations": [
+ [
+ "socar-inc",
+ 25,
+ 24
+ ]
+ ]
+ },
+ {
+ "name": "한글과컴퓨터",
+ "organizations": [
+ [
+ "hancom-io",
+ 24,
+ 4
+ ]
+ ]
+ },
+ {
+ "name": "엔씨소프트",
+ "organizations": [
+ [
+ "ncsoft",
+ 24,
+ 27
+ ]
+ ]
+ },
+ {
+ "name": "버켓플레이스",
+ "organizations": [
+ [
+ "bucketplace",
+ 23,
+ 34
+ ]
+ ]
+ },
+ {
+ "name": "비바리퍼블리카",
+ "organizations": [
+ [
+ "toss",
+ 22,
+ 200
+ ]
+ ]
+ },
+ {
+ "name": "마이리얼트립",
+ "organizations": [
+ [
+ "myrealtrip",
+ 19,
+ 13
+ ]
+ ]
+ },
+ {
+ "name": "쿠팡",
+ "organizations": [
+ [
+ "coupang",
+ 18,
+ 12
+ ]
+ ]
+ },
+ {
+ "name": "LG전자",
+ "organizations": [
+ [
+ "LGE-OSS",
+ 17,
+ 22
+ ]
+ ]
+ },
+ {
+ "name": "드라마앤컴퍼니",
+ "organizations": [
+ [
+ "dramancompany",
+ 17,
+ 11
+ ]
+ ]
+ },
+ {
+ "name": "야놀자",
+ "organizations": [
+ [
+ "yanolja",
+ 16,
+ 4
+ ]
+ ]
+ },
+ {
+ "name": "VCNC",
+ "organizations": [
+ [
+ "VCNC",
+ 14,
+ 7
+ ]
+ ]
+ },
+ {
+ "name": "다나와",
+ "organizations": [
+ [
+ "danawalab",
+ 16,
+ 4
+ ]
+ ]
+ },
+ {
+ "name": "뱅크샐러드",
+ "organizations": [
+ [
+ "banksalad",
+ 14,
+ 51
+ ]
+ ]
+ },
+ {
+ "name": "카카오엔터프라이즈",
+ "organizations": [
+ [
+ "kakaoenterprise",
+ 12,
+ 37
+ ]
+ ]
+ },
+ {
+ "name": "딜리셔스",
+ "organizations": [
+ [
+ "dealicious-inc",
+ 12,
+ 18
+ ]
+ ]
+ },
+ {
+ "name": "몰로코",
+ "organizations": [
+ [
+ "moloco",
+ 11,
+ 36
+ ]
+ ]
+ },
+ {
+ "name": "네이버제트",
+ "organizations": [
+ [
+ "naverz",
+ 10,
+ 31
+ ]
+ ]
+ },
+ {
+ "name": "SK텔레콤",
+ "organizations": [
+ [
+ "sktelecom",
+ 4,
+ 8
+ ]
+ ]
+ },
+ {
+ "name": "컬리",
+ "organizations": [
+ [
+ "thefarmersfront",
+ 8,
+ 31
+ ]
+ ]
+ },
+ {
+ "name": "티몬",
+ "organizations": [
+ [
+ "tmoncorp",
+ 8,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "메가존클라우드",
+ "organizations": [
+ [
+ "megazone-devops",
+ 8,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "현대자동차",
+ "organizations": [
+ [
+ "hkmc-airlab",
+ 4,
+ 22
+ ],
+ [
+ "42dot",
+ 2,
+ 6
+ ]
+ ]
+ },
+ {
+ "name": "포스코ICT",
+ "organizations": [
+ [
+ "poscoict-glueframework",
+ 9,
+ 2
+ ]
+ ]
+ },
+ {
+ "name": "요기요",
+ "organizations": [
+ [
+ "yogiyo",
+ 6,
+ 32
+ ]
+ ]
+ },
+ {
+ "name": "가비아",
+ "organizations": [
+ [
+ "gabia",
+ 5,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "힐링페이퍼",
+ "organizations": [
+ [
+ "healingpaper",
+ 4,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "11번가",
+ "organizations": [
+ [
+ "11st-corp",
+ 4,
+ 6
+ ]
+ ]
+ },
+ {
+ "name": "줌인터넷",
+ "organizations": [
+ [
+ "zuminternet",
+ 4,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "네이버랩스",
+ "organizations": [
+ [
+ "naverlabs",
+ 3,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "무신사",
+ "organizations": [
+ [
+ "musinsa",
+ 3,
+ 6
+ ]
+ ]
+ },
+ {
+ "name": "SK",
+ "organizations": [
+ [
+ "SK-HOLDINGS-CC",
+ 0,
+ 0
+ ],
+ [
+ "cloudsvcdev",
+ 3,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "카카오페이",
+ "organizations": [
+ [
+ "kakaopay",
+ 1,
+ 3
+ ]
+ ]
+ },
+ {
+ "name": "신한은행",
+ "organizations": [
+ [
+ "Shinhan-Bank",
+ 1,
+ 2
+ ]
+ ]
+ },
+ {
+ "name": "크레프톤",
+ "organizations": [
+ [
+ "Krafton",
+ 0,
+ 1
+ ]
+ ]
+ },
+ {
+ "name": "카카오뱅크",
+ "organizations": [
+ [
+ "kakaobank",
+ 0,
+ 3
+ ]
+ ]
+ },
+ {
+ "name": "카카오헤어샵",
+ "organizations": [
+ [
+ "kakaohairshop",
+ 12,
+ 4
+ ]
+ ]
+ },
+ {
+ "name": "플라네타리움",
+ "organizations": [
+ [
+ "planetarium",
+ 91,
+ 56
+ ]
+ ]
+ }
+]
diff --git a/github.md b/github.md
index 3f70af9..e38ef72 100644
--- a/github.md
+++ b/github.md
@@ -1,65 +1,67 @@
# 국내 IT 기업 Github 레포지터리 목록
국내 주요 IT 기업의 Github Org 계정의 레포지터리 주소와 총 공개 레포지터리 숫자 및 팔로워를 모았습니다. 이러한 숫자가 절대적인 기준이 될 수는 없겠지만, 얼마나 오픈 소스 활동 및 투명한 정보 공개를 하고 있는지 알 수 있을 것입니다.
-※ 혹시 여러분의 회사가 빠져 있거나, 데이터 수정이 필요한 경우 Pull Request 올려 주시기 바랍니다.
+
| **회사명** | **레포지터리 수** | **팔로워 수** | **Github 주소** |
|:---|---:|---:|:---|
-| 티맥스클라우드 | 245 | 15 | https://github.com/tmax-cloud |
-| 네이버 | 214 | 445 | https://github.com/naver |
-| 인베슘 | 163 | 11 | https://github.com/hamonikr |
-| 삼성전자 | 155 | - | https://github.com/Samsung |
-| 센드버드 | 155 | 62 | https://github.com/sendbird |
-| 데브시스터즈 | 150 | 61 | https://github.com/devsisters |
-| 리디 | 123 | 27 | https://github.com/ridi |
-| 라인 | 109 | 297 | https://github.com/line |
-| 당근마켓 | 103 | 271 | https://github.com/daangn |
-| NHN | 103 | 216 | https://github.com/nhn |
-| 래블업 | 101 | 18 | https://github.com/lablup |
-| 하이퍼커넥트 | 99 | 14 | https://github.com/hyperconnect |
-| 삼성SDS | 84 | 4 | https://github.com/samsung-cnct (70)
https://github.com/SDSACT
(7)https://github.com/samsungsds-rnd (7) |
-| 뤼이드 | 53 | 21 | https://github.com/riiid |
-| 버즈빌 | 53 | 6 | https://github.com/Buzzvil |
-| 카카오 | 50 | 157 | https://github.com/kakao |
-| 네이버클라우드 | 40 | 20 | https://github.com/NaverCloudPlatform |
-| 카카오브레인 | 27 | 216 | https://github.com/kakaobrain |
-| 그린랩스 | 27 | 37 | https://github.com/green-labs |
-| 직방 | 26 | 20 | https://github.com/zigbang |
-| 우아한형제들 | 25 | 42 | https://github.com/woowabros |
-| 쏘카 | 25 | 21 | https://github.com/socar-inc |
+| 티맥스클라우드 | 245 | 17 | https://github.com/tmax-cloud |
+| 네이버 | 214 | 463 | https://github.com/naver |
+| 인베슘 | 163 | 12 | https://github.com/hamonikr |
+| 삼성전자 | 155 | 278 | https://github.com/Samsung |
+| 센드버드 | 155 | 68 | https://github.com/sendbird |
+| 데브시스터즈 | 150 | 69 | https://github.com/devsisters |
+| 리디 | 123 | 29 | https://github.com/ridi |
+| 라인 | 109 | 306 | https://github.com/line |
+| 당근마켓 | 103 | 281 | https://github.com/daangn |
+| NHN | 103 | 224 | https://github.com/nhn |
+| 래블업 | 102 | 22 | https://github.com/lablup |
+| 하이퍼커넥트 | 99 | 17 | https://github.com/hyperconnect |
+| 삼성SDS | 84 | 8 | https://github.com/samsung-cnct (70)
https://github.com/SDSACT (7)
https://github.com/samsungsds-rnd (7) |
+| 뤼이드 | 53 | 22 | https://github.com/riiid |
+| 버즈빌 | 53 | 8 | https://github.com/Buzzvil |
+| 카카오 | 50 | 158 | https://github.com/kakao |
+| 네이버클라우드 | 40 | 22 | https://github.com/NaverCloudPlatform |
+| 카카오브레인 | 29 | 219 | https://github.com/kakaobrain |
+| 그린랩스 | 28 | 38 | https://github.com/green-labs |
+| 직방 | 26 | 21 | https://github.com/zigbang |
+| 우아한형제들 | 25 | 44 | https://github.com/woowabros |
+| 쏘카 | 25 | 24 | https://github.com/socar-inc |
| 한글과컴퓨터 | 24 | 4 | https://github.com/hancom-io |
-| 엔씨소프트 | 23 | 27 | https://github.com/ncsoft |
-| 버켓플레이스 | 23 | - | https://github.com/bucketplace |
-| 비바리퍼블리카 | 22 | 195 | https://github.com/toss |
-| 마이리얼트립 | 20 | 13 | https://github.com/myrealtrip |
-| 쿠팡 | 18 | 11 | https://github.com/coupang |
+| 엔씨소프트 | 24 | 27 | https://github.com/ncsoft |
+| 버켓플레이스 | 23 | 34 | https://github.com/bucketplace |
+| 비바리퍼블리카 | 22 | 200 | https://github.com/toss |
+| 마이리얼트립 | 19 | 13 | https://github.com/myrealtrip |
+| 쿠팡 | 18 | 12 | https://github.com/coupang |
| LG전자 | 17 | 22 | https://github.com/LGE-OSS |
-| 드라마앤컴퍼니 | 16 | 11 | https://github.com/dramancompany |
+| 드라마앤컴퍼니 | 17 | 11 | https://github.com/dramancompany |
| 야놀자 | 16 | 4 | https://github.com/yanolja |
-| VCNC | 16 | 6 | https://github.com/VCNC |
+| VCNC | 14 | 7 | https://github.com/VCNC |
| 다나와 | 16 | 4 | https://github.com/danawalab |
-| 뱅크샐러드 | 14 | 49 | https://github.com/banksalad |
-| 카카오엔터프라이즈 | 12 | 36 | https://github.com/kakaoenterprise |
-| 딜리셔스 | 12 | - | https://github.com/dealicious-inc |
-| 몰로코 | 11 | 35 | https://github.com/moloco |
-| 네이버제트 | 10 | - | https://github.com/naverz |
-| SK텔레콤 | 8 | 4 | https://github.com/sktelecom |
+| 뱅크샐러드 | 14 | 51 | https://github.com/banksalad |
+| 카카오엔터프라이즈 | 12 | 37 | https://github.com/kakaoenterprise |
+| 딜리셔스 | 12 | 18 | https://github.com/dealicious-inc |
+| 몰로코 | 11 | 36 | https://github.com/moloco |
+| 네이버제트 | 10 | 31 | https://github.com/naverz |
+| SK텔레콤 | 4 | 8 | https://github.com/sktelecom |
| 컬리 | 8 | 31 | https://github.com/thefarmersfront |
-| 티몬 | 8 | - | https://github.com/tmoncorp |
-| 메가존클라우드 | 8 | - | https://github.com/megazone-devops |
-| 현대자동차 | 6 | 6 | https://github.com/hkmc-airlab
(4)https://github.com/42dot (2) |
-| 포스코ICT | 6 | 1 | https://github.com/poscoict-glueframework |
-| 요기요 | 6 | - | https://github.com/yogiyo |
-| 가비아 | 5 | - | https://github.com/gabia |
-| 힐링페이퍼 | 5 | - | https://github.com/healingpaper |
+| 티몬 | 8 | 0 | https://github.com/tmoncorp |
+| 메가존클라우드 | 8 | 0 | https://github.com/megazone-devops |
+| 현대자동차 | 6 | 28 | https://github.com/hkmc-airlab (4)
https://github.com/42dot (2) |
+| 포스코ICT | 9 | 2 | https://github.com/poscoict-glueframework |
+| 요기요 | 6 | 32 | https://github.com/yogiyo |
+| 가비아 | 5 | 0 | https://github.com/gabia |
+| 힐링페이퍼 | 4 | 0 | https://github.com/healingpaper |
| 11번가 | 4 | 6 | https://github.com/11st-corp |
-| 줌인터넷 | 4 | 4 | https://github.com/zuminternet |
+| 줌인터넷 | 4 | 5 | https://github.com/zuminternet |
| 네이버랩스 | 3 | 5 | https://github.com/naverlabs |
-| 무신사 | 3 | 1 | https://github.com/musinsa |
-| SK C&C | 3 | - | https://github.com/SK-HOLDINGS-CC
https://github.com/cloudsvcdev (3) |
+| 무신사 | 3 | 6 | https://github.com/musinsa |
+| SK | 3 | 0 | https://github.com/SK-HOLDINGS-CC (0)
https://github.com/cloudsvcdev (3) |
| 카카오페이 | 1 | 3 | https://github.com/kakaopay |
-| 신한은행 | 1 | 1 | https://github.com/Shinhan-Bank |
+| 신한은행 | 1 | 2 | https://github.com/Shinhan-Bank |
| 크레프톤 | 0 | 1 | https://github.com/Krafton |
| 카카오뱅크 | 0 | 3 | https://github.com/kakaobank |
| 카카오헤어샵 | 12 | 4 | https://github.com/kakaohairshop |
| 플라네타리움 | 91 | 56 | https://github.com/planetarium |
+
+
diff --git a/src/update-json.py b/src/update-json.py
new file mode 100644
index 0000000..a2fbdf8
--- /dev/null
+++ b/src/update-json.py
@@ -0,0 +1,59 @@
+# load json
+
+import json
+import asyncio
+import aiohttp
+import os.path
+import sys
+
+TOKEN = sys.argv[1]
+
+dir_path = os.path.dirname(os.path.realpath(__file__))
+
+async def fetchStat(organization, session):
+ url = f'https://api.github.com/orgs/{organization}'
+ print(url)
+
+ async with session.get(url) as response:
+ data = await response.text()
+ info = json.loads(data)
+
+ try:
+ return [organization, info['public_repos'], info['followers']]
+ except:
+ print(info)
+ return [organization]
+
+async def main():
+ file_path = os.path.join(dir_path, '../github.json')
+
+ with open(file_path, 'r') as file:
+ companies = json.load(file)
+
+ items = []
+ async with aiohttp.ClientSession(headers={
+ 'Authorization': f'Bearer {TOKEN}'
+ }) as session:
+ for company in companies:
+ await asyncio.sleep(0.3)
+ stats = await asyncio.gather(*[fetchStat(item[0], session) for item in company['organizations']])
+ print(stats)
+
+ for idx, stat in enumerate(stats):
+ if len(stat) == 1:
+ for org in company['organizations']:
+ if org[0] == stat[0]:
+ if len(org) != 3:
+ stats[idx] = [org[0], 0, 0]
+ else:
+ stats[idx] = org
+
+ items.append({ 'name': company['name'], 'organizations': stats })
+
+ with open(file_path, 'w') as file:
+ json.dump(items, file, ensure_ascii=False, indent=2, sort_keys=True)
+
+ # add newline to eof
+ file.write('\n')
+
+asyncio.run(main())
diff --git a/src/update-markdown.py b/src/update-markdown.py
new file mode 100644
index 0000000..d47a351
--- /dev/null
+++ b/src/update-markdown.py
@@ -0,0 +1,78 @@
+import os.path
+import json
+
+def render_table_header():
+ return '''| **회사명** | **레포지터리 수** | **팔로워 수** | **Github 주소** |
+|:---|---:|---:|:---|
+'''
+
+def render_table_row(company):
+ print(company)
+ markdown = '|'
+ markdown += f" {company['name']} |"
+
+ total_public_repos = 0
+ total_followers = 0
+
+ stats = company['organizations']
+ for stat in stats:
+ total_public_repos += stat[1]
+ total_followers += stat[2]
+
+ markdown += f" {total_public_repos} |"
+ markdown += f" {total_followers} |"
+
+ if len(stats) == 1:
+ markdown += f" https://github.com/{stats[0][0]} |"
+ else:
+ markdown += " "
+ for idx, stat in enumerate(stats):
+ markdown += f"https://github.com/{stat[0]} ({stat[1]})"
+ if idx != len(stats) - 1:
+ markdown += '
'
+ markdown += " |"
+
+ markdown += "\n"
+ return markdown
+
+START_TAG = '\n'
+END_TAG = '\n'
+
+def inject_result_to_readme(readme_path, injected_content):
+ with open(readme_path) as readme:
+ readme_content = readme.read()
+ start_index = readme_content.find(START_TAG)
+ end_index = readme_content.find(END_TAG)
+
+ updated_content = (readme_content[0:start_index]
+ + START_TAG + '\n'
+ + injected_content
+ + readme_content[end_index:])
+
+ with open(readme_path, 'w') as readme:
+ readme.write(updated_content)
+
+dir_path = os.path.dirname(os.path.realpath(__file__))
+file_path = os.path.join(dir_path, '../github.json')
+
+with open(file_path, 'r') as file:
+ companies = json.load(file)
+
+# all companies
+readme_path = os.path.join(dir_path, '../github.md')
+markdown = render_table_header()
+
+for company in companies:
+ markdown += render_table_row(company)
+
+inject_result_to_readme(readme_path, markdown)
+
+# top 10 companies
+readme_path = os.path.join(dir_path, '../README.md')
+markdown = render_table_header()
+
+top_10_companies = sorted(companies, key = lambda item: sum(org[1] for org in item['organizations']), reverse=True)[:10]
+for company in top_10_companies:
+ markdown += render_table_row(company)
+
+inject_result_to_readme(readme_path, markdown)