Skip to content

Commit

Permalink
feat(google-sheet): main 페이지 데이터 불러오기(#26)
Browse files Browse the repository at this point in the history
* ci: 구글 시트 메인 불러오기

* [bot] update files

* ci: main.json 생성 스크립트 추가

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
mcauto and actions-user committed Oct 24, 2021
1 parent 2111380 commit c146809
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/google-sheet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
spreadsheetId: ${{ secrets.SPREADSHEET_ID }}
commands: | # list of commands, specified as a valid JSON string
[
{ "command": "getData", "args": { "worksheetTitle": "main", "minCol": 1 } }
{ "command": "getData", "args": { "worksheetTitle": "_main", "minCol": 1 } }
]
env:
GSHEET_CLIENT_EMAIL: ${{ secrets.GSHEET_CLIENT_EMAIL }}
Expand Down
28 changes: 28 additions & 0 deletions .script/make_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/usr/python3.9
import json

if __name__ == "__main__":
with open("./_content/main.json", mode="r") as f:
google_results = f.read()

_main = json.loads(google_results)
rows = _main["results"][0]["result"]["rawData"]

slogan, default_desc, default_a, default_href, th, recruitment_start, recruitment_deadline, recruitment_notice_desc, recruitment_notice_a, recruitment_in_progress_desc, recruitment_in_progress_a, recruitment_href = row[1]
main = {
slogan: slogan,
default_desc: default_desc,
default_a: default_a,
default_href: default_href,
th: th,
recruitment_start: recruitment_start,
recruitment_deadline: recruitment_deadline,
recruitment_notice_desc: recruitment_notice_desc,
recruitment_notice_a: recruitment_notice_a,
recruitment_in_progress_desc: recruitment_in_progress_desc,
recruitment_in_progress_a: recruitment_in_progress_a,
recruitment_href: recruitment_href,
}

with open(f"./content/main.json", mode="w", encoding="utf-8") as f:
f.write(json.dumps(main, ensure_ascii=False, indent=2))
2 changes: 1 addition & 1 deletion _content/main.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"results":[{"command":{"func":"getData","kwargs":[{"minCol":1,"worksheetTitle":"main"},null]},"result":{"rawData":[["구글 드라이브 메인 이미지 ID","메인 타이틀","메인 서브 타이틀","상세 링크 타이틀","상세 링크 우측 버튼 유무","상세 링크 경로","D-Day 표시","D-Day 텍스트","D-Day 배경색상 이름","D-Day 배경색상 hex","사용 여부"],["1XyPcA3KsEO04sZ5pbdWVep3D6MmASEf7","IT Community\nfor Experts","개발자와 디자이너를 위한 IT 커뮤니티입니다.","넥스터즈 알아보기","FALSE","ABOUT","FALSE","","text-inverse","#FFFFFF","FALSE"],["1XyPcA3KsEO04sZ5pbdWVep3D6MmASEf7","IT Community\nfor Experts","10월 24일 넥스터즈 20기 모집이 시작됩니다.","20기 모집 안내 보기","TRUE","RECRUITMENT","FALSE","","text-inverse","#FFFFFF","TRUE"],["1XyPcA3KsEO04sZ5pbdWVep3D6MmASEf7","IT Community\nfor Experts","현재 넥스터즈 20기 모집중이에요","20기 지원하러가기","FALSE","RECRUITMENT","TRUE","마감","text-inverse","#FFFFFF","FALSE"]],"formatted":[{"(A)":"구글 드라이브 메인 이미지 ID","(B)":"메인 타이틀","(C)":"메인 서브 타이틀","(D)":"상세 링크 타이틀","(E)":"상세 링크 우측 버튼 유무","(F)":"상세 링크 경로","(G)":"D-Day 표시","(H)":"D-Day 텍스트","(I)":"D-Day 배경색상 이름","(J)":"D-Day 배경색상 hex","(K)":"사용 여부"},{"(A)":"1XyPcA3KsEO04sZ5pbdWVep3D6MmASEf7","(B)":"IT Community\nfor Experts","(C)":"개발자와 디자이너를 위한 IT 커뮤니티입니다.","(D)":"넥스터즈 알아보기","(E)":"FALSE","(F)":"ABOUT","(G)":"FALSE","(H)":"","(I)":"text-inverse","(J)":"#FFFFFF","(K)":"FALSE"},{"(A)":"1XyPcA3KsEO04sZ5pbdWVep3D6MmASEf7","(B)":"IT Community\nfor Experts","(C)":"10월 24일 넥스터즈 20기 모집이 시작됩니다.","(D)":"20기 모집 안내 보기","(E)":"TRUE","(F)":"RECRUITMENT","(G)":"FALSE","(H)":"","(I)":"text-inverse","(J)":"#FFFFFF","(K)":"TRUE"},{"(A)":"1XyPcA3KsEO04sZ5pbdWVep3D6MmASEf7","(B)":"IT Community\nfor Experts","(C)":"현재 넥스터즈 20기 모집중이에요","(D)":"20기 지원하러가기","(E)":"FALSE","(F)":"RECRUITMENT","(G)":"TRUE","(H)":"마감","(I)":"text-inverse","(J)":"#FFFFFF","(K)":"FALSE"}],"header":["(A)","(B)","(C)","(D)","(E)","(F)","(G)","(H)","(I)","(J)","(K)"],"range":"main!A1:AA1000"}}]}
{"results":[{"command":{"func":"getData","kwargs":[{"minCol":1,"worksheetTitle":"_main"},null]},"result":{"rawData":[["슬로건","기본 설명","기본 링크","기수","모집 시작일","모집 마감일","모집 안내 문구","모집 안내 링크 문구","모집 중 안내 문구","모집중 링크 문구","모집 링크"],["IT Community\\nfor Experts","개발자와 디자이너를 위한 IT 커뮤니티입니다.","/about","20","2021-11-01","2021-11-14","모집이 시작 됩니다.","모집 안내 보기","모집중이에요.","지원하러가기","/recruitment"]],"formatted":[{"(A)":"슬로건","(B)":"기본 설명","(C)":"기본 링크","(D)":"기수","(E)":"모집 시작일","(F)":"모집 마감일","(G)":"모집 안내 문구","(H)":"모집 안내 링크 문구","(I)":"모집 중 안내 문구","(J)":"모집중 링크 문구","(K)":"모집 링크"},{"(A)":"IT Community\\nfor Experts","(B)":"개발자와 디자이너를 위한 IT 커뮤니티입니다.","(C)":"/about","(D)":"20","(E)":"2021-11-01","(F)":"2021-11-14","(G)":"모집이 시작 됩니다.","(H)":"모집 안내 보기","(I)":"모집중이에요.","(J)":"지원하러가기","(K)":"/recruitment"}],"header":["(A)","(B)","(C)","(D)","(E)","(F)","(G)","(H)","(I)","(J)","(K)"],"range":"'_main'!A1:Z1000"}}]}

0 comments on commit c146809

Please sign in to comment.