update
This commit is contained in:
parent
4951c06b70
commit
2ad78699ed
26
main.py
26
main.py
@ -34,11 +34,11 @@ Top Leetcode Skills
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
import base64
|
||||||
|
|
||||||
# external
|
# external
|
||||||
|
|
||||||
from gitea import *
|
import gitea
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
############## data ##################
|
############## data ##################
|
||||||
@ -57,6 +57,9 @@ class LeetcodeInput:
|
|||||||
gitea_token: str = os.getenv("GITHUB_TOKEN")
|
gitea_token: str = os.getenv("GITHUB_TOKEN")
|
||||||
gitea_url: str = os.getenv("GITHUB_SERVER_URL")
|
gitea_url: str = os.getenv("GITHUB_SERVER_URL")
|
||||||
leetcode_username: str = os.getenv("USERNAME")
|
leetcode_username: str = os.getenv("USERNAME")
|
||||||
|
gitea_username: str = os.getenv("GITHUB_REPOSITORY").split("/")[0]
|
||||||
|
gitea_repo: str = os.getenv("GITHUB_REPOSITORY").split("/")[1]
|
||||||
|
gitea_branch: str = os.getenv("GITHUB_REF_NAME")
|
||||||
|
|
||||||
# # depends
|
# # depends
|
||||||
commit_message: str = os.getenv("INPUT_COMMIT_MESSAGE", "Update leetcode status")
|
commit_message: str = os.getenv("INPUT_COMMIT_MESSAGE", "Update leetcode status")
|
||||||
@ -86,10 +89,27 @@ def fetch_data() -> str:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def genesis() -> None:
|
def update_readme(new_content):
|
||||||
|
"""Update and push"""
|
||||||
|
b64_new_content = base64.b64encode(bytes(new_content, encoding="utf-8"))
|
||||||
|
repo_content = git
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def genesis() -> None:
|
||||||
|
"""Run Program"""
|
||||||
|
gitea_connection = gitea.Gitea(lc_i.gitea_url, lc_i.gitea_token)
|
||||||
|
|
||||||
|
gitea_repo = gitea.Repository.request(
|
||||||
|
gitea_connection, lc_i.gitea_username, lc_i.gitea_repo
|
||||||
|
)
|
||||||
|
|
||||||
|
readme_raw_data = fetch_raw_readme()
|
||||||
|
readme_contents = str(base64.b64decode(readme_raw_data), encoding="utf-8")
|
||||||
|
if not (new_content := churn(readme_contents)):
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
lc_i = LeetcodeInput()
|
lc_i = LeetcodeInput()
|
||||||
if not lc_i.validate_input():
|
if not lc_i.validate_input():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user