Skip to content

Commit

Permalink
Clean repo 1 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
HU-Lee authored Feb 17, 2024
1 parent 294879c commit e29502b
Show file tree
Hide file tree
Showing 37 changed files with 231 additions and 247 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/docs-personal/wiki/**
/content-personal/wiki/**
40 changes: 40 additions & 0 deletions assets/jinja_template/README-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<p align="center">
<a href="https://github.com/{{ repo }}">
<img src="logo.png" alt="Logo">
</a>

<p align="center">
{{ description }}
<br>
<br>
{%- if homepage %}
<a href="{{ homepage }}"><strong>View the website »</strong></a>
<br>
<br>
{%- endif %}
<a href="https://github.com/{{ repo }}/issues">Bug Report</a>
|
<a href="https://github.com/{{ repo }}/issues">Request to HU-Lee</a>
</p>

<p align="center">
{%- for stack in stacks %}
<a href="{{ stack['href'] }}">
<img src="{{ stack['src'] }}" alt="{{ stack['name'] }}">
</a>
{%- endfor %}
<a href="./LICENSE">
<img src="https://img.shields.io/github/license/{{ repo }}" alt="License">
</a>
</p>
</p>

<!-- Content -->

<br>

## Contributing

See the [CONTRIBUTING.md][contributing].

[contributing]: ./CONTRIBUTING.md
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"BeaverHouse/dive-argo-fastapi": ["Python", "FastAPI"],
"HU-Lee/aecheck-v2": ["React", "TypeScript", "Yarn"],
"HU-Lee/anotherdungeon": [],
"HU-Lee/LeetCode": ["Python", "TypeScript", "Go", "JavaScript"],
"HU-Lee/BOJ": ["Python", "TypeScript", "Go"]
"HU-Lee/LeetCode": ["TypeScript", "JavaScript", "Python", "Go"],
"HU-Lee/BOJ": ["TypeScript", "Python", "Go"]
}
77 changes: 77 additions & 0 deletions assets/json/stacks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[
{
"href": "https://react.dev/",
"src": "https://img.shields.io/badge/React-61DAFB.svg?style=flat&logo=React&logoColor=black",
"name": "React"
},
{
"href": "https://www.typescriptlang.org/",
"src": "https://img.shields.io/badge/TypeScript-3178C6.svg?style=flat&logo=TypeScript&logoColor=white",
"name": "TypeScript"
},
{
"href": "https://developer.mozilla.org/ko/docs/Web/JavaScript",
"src": "https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=000&style=flat",
"name": "JavaScript"
},
{
"href": "https://eslint.org/",
"src": "https://img.shields.io/badge/ESLint-4B32C3?logo=eslint&logoColor=fff&style=flat",
"name": "ESLint"
},
{
"href": "https://yarnpkg.com/",
"src": "https://img.shields.io/badge/Yarn-2C8EBB?logo=yarn&logoColor=fff&style=flat",
"name": "Yarn"
},
{
"href": "https://daringfireball.net/projects/markdown/",
"src": "https://img.shields.io/badge/Markdown-000000.svg?style&logo=Markdown&logoColor=white",
"name": "Markdown"
},
{
"href": "https://helm.sh/",
"src": "https://img.shields.io/badge/Helm-0F1689?logo=helm&logoColor=fff&style=flat",
"name": "Helm"
},
{
"href": "https://yaml.org/",
"src": "https://img.shields.io/badge/YAML-CB171E.svg?style=flat&logo=YAML&logoColor=white",
"name": "YAML"
},
{
"href": "https://www.python.org/",
"src": "https://img.shields.io/badge/Python-3776AB.svg?style=flat&logo=Python&logoColor=white",
"name": "Python"
},
{
"href": "https://fastapi.tiangolo.com/",
"src": "https://img.shields.io/badge/FastAPI-009688?logo=fastapi&logoColor=fff&style=flat",
"name": "FastAPI"
},
{
"href": "https://python-poetry.org/",
"src": "https://img.shields.io/badge/Poetry-60A5FA.svg?style=flat&logo=Poetry&logoColor=white",
"name": "Poetry"
},
{
"href": "https://pandas.pydata.org/",
"src": "https://img.shields.io/badge/pandas-150458.svg?style=flat&logo=pandas&logoColor=white",
"name": "pandas"
},
{
"href": "https://docs.pytest.org/en/8.0.x/",
"src": "https://img.shields.io/badge/Pytest-0A9EDC.svg?style=flat&logo=Pytest&logoColor=white",
"name": "Pytest"
},
{
"href": "https://gohugo.io/",
"src": "https://img.shields.io/badge/Hugo-FF4088?logo=hugo&logoColor=fff&style=flat",
"name": "Hugo"
},
{
"href": "https://go.dev/",
"src": "https://img.shields.io/badge/Go-00ADD8?logo=go&logoColor=fff&style=flat",
"name": "Go"
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 5 additions & 10 deletions hub/checking/repo_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def check_repository_settings(repo: str):
repository_info = issue_response["data"]["repository"]
issue_total_count = repository_info["issues"]["totalCount"]

with open('hub/checking/json/repo_categories.json', 'r') as f:
with open('assets/json/repo_features.json', 'r') as f:
repo_config = json.load(f)
categories = repo_config[repo]

Expand All @@ -23,8 +23,10 @@ def check_repository_settings(repo: str):
assert repository_info["hasWikiEnabled"] == ("Wiki" in categories)
assert repository_info["hasDiscussionsEnabled"] == ("Discussions" in categories)
assert repository_info["hasIssuesEnabled"] == ("Deprecated" not in categories or issue_total_count > 0)
if not repository_info["hasVulnerabilityAlertsEnabled"]:
assert repository_info["isArchived"] and ("Deprecated" in categories)

for key in ["name", "description", "isTemplate", "hasWikiEnabled", "hasDiscussionsEnabled", "hasIssuesEnabled"]:
for key in ["name", "description", "isTemplate", "hasWikiEnabled", "hasDiscussionsEnabled", "hasIssuesEnabled", "hasVulnerabilityAlertsEnabled", "isArchived", "issues"]:
del repository_info[key]

requiredStatusChecks = list(filter(
Expand All @@ -36,14 +38,7 @@ def check_repository_settings(repo: str):
) == sorted(requiredStatusChecks)
del repository_info["branchProtectionRules"]["nodes"][0]["requiredStatusChecks"]

if not repository_info["hasVulnerabilityAlertsEnabled"]:
assert repository_info["isArchived"] and ("Deprecated" in categories)

del repository_info["isArchived"]
del repository_info["hasVulnerabilityAlertsEnabled"]
del repository_info["issues"]

with open('hub/checking/json/graphql_response.json', 'r') as f:
with open('assets/json/graphql_response.json', 'r') as f:
response_template = json.load(f)

# Sort labels separately
Expand Down
110 changes: 0 additions & 110 deletions hub/making/jinja_template/README-template.md

This file was deleted.

23 changes: 5 additions & 18 deletions hub/making/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,18 @@ def make_readme(repo: str):
issue_response = get_graphql_response(issue_query, org= ORG_NAME in repo)
repository_info = issue_response["data"]["repository"]

with open('hub/making/jinja_template/repository.json', 'r') as f:
with open('assets/json/repo_stacks.json', 'r') as f:
repo_config = json.load(f)
stacks = repo_config[repo]
with open('assets/json/stacks.json', 'r') as f:
stacks = [x for x in json.load(f) if x['name'] in repo_config[repo]]

template = jinja2.Template(get_text_from_file('hub/making/jinja_template/README-template.md'))
template = jinja2.Template(get_text_from_file('assets/jinja_template/README-template.md'))

rendered_readme = template.render(
repo=repo,
description=repository_info["description"],
homepage=repository_info["homepageUrl"],
markdown = "Markdown" in stacks,
yaml = "YAML" in stacks,
python = "Python" in stacks,
pytest = "Pytest" in stacks,
pandas = "pandas" in stacks,
poetry = "Poetry" in stacks,
react = "React" in stacks,
typescript = "TypeScript" in stacks,
javascript = "JavaScript" in stacks,
hugo = "Hugo" in stacks,
helm = "Helm" in stacks,
fastapi = "FastAPI" in stacks,
eslint = "ESLint" in stacks,
yarn = "Yarn" in stacks,
golang = "Go" in stacks
stacks = stacks
)

with open(f'result/readme/{name}.md', 'w+', encoding='utf-8') as readme:
Expand Down
2 changes: 1 addition & 1 deletion hub/process/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def md_to_text(content: str) -> str:
.replace(u'\xa0', u' ')

def codecov_preprocess(content: str) -> str:
content = re.sub(r'\s*<a href="https://codecov.io.*</a>\s', "\n", content, flags=re.DOTALL)
content = re.sub(r'\s*<a href="https://codecov.io.*?</a>\s', "\n", content, flags=re.DOTALL)

return content

Expand Down
Loading

0 comments on commit e29502b

Please sign in to comment.