Skip to content

Commit

Permalink
Docs : Update update_recent_works.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimgabe authored Feb 11, 2024
1 parent 6d9c902 commit 4e7f10e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/scripts/update_recent_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@

# "๐Ÿ“ Recent Work Updates" ์„น์…˜ ์ฐพ๊ธฐ ๋ฐ ๊ธฐ์กด ํ‘œ ์ œ๊ฑฐ
if "๐Ÿ“ Recent Work Updates" in readme_content:
# ๊ธฐ์กด ํ‘œ๊ฐ€ ์žˆ๋‹ค๋ฉด ์ œ๊ฑฐํ•˜๊ณ  ์„น์…˜ ์ œ๋ชฉ๋งŒ ๋‚จ๊น€
readme_content = readme_content.split("๐Ÿ“ Recent Work Updates")[0] + "## ๐Ÿ“ Recent Work Updates\n\n"
else:
# ์„น์…˜ ์ œ๋ชฉ ์ถ”๊ฐ€
readme_content += "\n\n## ๐Ÿ“ Recent Work Updates\n\n"

# ์ปค๋ฐ‹ ๋กœ๊ทธ์—์„œ ์ตœ๊ทผ 10๊ฐœ์˜ ํ•ญ๋ชฉ ๊ฐ€์ ธ์˜ค๊ธฐ (.github ํด๋” ๋ฐ README.md ์ œ์™ธ)
# ์ปค๋ฐ‹ ๋กœ๊ทธ์—์„œ ์ตœ๊ทผ 10๊ฐœ์˜ ํ•ญ๋ชฉ ๊ฐ€์ ธ์˜ค๊ธฐ (.github ํด๋”, README.md, .DS_Store ์ œ์™ธ)
commits = repo.get_commits() # ์ €์žฅ์†Œ์˜ ์ปค๋ฐ‹ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜ด
recent_updates = [] # ์ตœ๊ทผ ์—…๋ฐ์ดํŠธ ์ •๋ณด๋ฅผ ์ €์žฅํ•  ๋ฆฌ์ŠคํŠธ
count = 0 # ์ฒ˜๋ฆฌ๋œ ์ปค๋ฐ‹ ์ˆ˜๋ฅผ ์„ธ๊ธฐ ์œ„ํ•œ ์นด์šดํ„ฐ
Expand All @@ -62,26 +60,26 @@
break
files = commit.files
for file in files:
if file.filename.endswith("README.md") or file.filename.startswith(".github/"):
continue
if file.filename.endswith("README.md") or file.filename.startswith(".github/") or file.filename.endswith(".DS_Store"):
continue # .DS_Store ํŒŒ์ผ๋„ ๋ฌด์‹œ
date = commit.commit.author.date.strftime("%Y-%m-%d")
author = commit.commit.author.name
commit_message = commit.commit.message.split('\n')[0] # ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€์˜ ์ฒซ ์ค„๋งŒ ์‚ฌ์šฉ
commit_message = commit.commit.message.split('\n')[0]
commit_type = commit_message.split(':')[0] if ':' in commit_message else 'N/A'
path_elements = file.filename.split('/')
category = path_elements[0] if len(path_elements) > 1 else 'Root'
name = path_elements[-1]
url = file.raw_url
recent_updates.append(f"| {date} | {category} | {name} | [View]({url}) | {author} | {commit_type} |") # ์ค„๋ฐ”๊ฟˆ์„ ๊ณต๋ฐฑ์œผ๋กœ ๋Œ€์ฒดํ•˜์—ฌ ์ถ”๊ฐ€
recent_updates.append(f"| {date} | {category} | {name} | [View]({url}) | {author} | {commit_type} |")
count += 1
if count >= 10:
break

# ํ‘œ ํ˜•์‹์œผ๋กœ README.md์— ์ตœ๊ทผ ์—…๋ฐ์ดํŠธ ์ •๋ณด ์ถ”๊ฐ€
if recent_updates: # ์ตœ๊ทผ ์—…๋ฐ์ดํŠธ๊ฐ€ ์žˆ์œผ๋ฉด ํ‘œ๋ฅผ ์ถ”๊ฐ€
if recent_updates:
table_header = "| ๋‚ ์งœ | ๋ถ„๋ฅ˜ | ์ž‘์—…๋ช… | ๋งํฌ | ์ž‘์—…์ž | Commit ์œ ํ˜• |\n| --- | --- | --- | --- | --- | --- |\n"
table = table_header + "\n".join(recent_updates)
readme_content += table # ํ…Œ์ด๋ธ” ๋‚ด์šฉ์„ README ๋‚ด์šฉ์— ์ถ”๊ฐ€
readme_content += table

# README.md ์—…๋ฐ์ดํŠธ
commit_message = "Docs : README.md ์—…๋ฐ์ดํŠธ: ์ปค๋ฐ‹ ์ปจ๋ฒค์…˜ ํ† ๊ธ€ ๋ฐ ์ตœ๊ทผ ์ž‘์—… ์—…๋ฐ์ดํŠธ"
Expand Down

0 comments on commit 4e7f10e

Please sign in to comment.