tomgarden / tomgitactions Goto Github PK
View Code? Open in Web Editor NEW通过 GitHub action 维护的 issues Blog
Home Page: https://github.com/TomGarden/TomGitActions/issues/45
通过 GitHub action 维护的 issues Blog
Home Page: https://github.com/TomGarden/TomGitActions/issues/45
又到了夏天, 蝉又要叫了
一个个人博客程序 : 通过 github actions 将 github repository 中的 markdown 文件发布到该 repository 的 issues 中 .
抄自 : https://github.com/Sep0lkit/git-issues-blog
对 markdown 中的链接语法 [](http 巴拉巴拉)
支持的不够完善 .
当前是通过 EL(Expression Language) 表达式完成的匹配与替换
# 甚至在我贴出这段代码的时候我都在担心这段代码会把我贴出的这段代码给替换的啥都不是了 , 细想了一下发现没问题 😁
# 局限性的问题的一个表现就是还需要想一下
def replace_markdown_links(input_str: str, path: str) -> str:
pattern = r'\[(.*?)\]\((?!http)(.*?)\)'
re_format = "[\\1](https://raw.githubusercontent.com/{}/{}/{}/\\2)".format(
GITHUB_REPO, GITHUB_BRANCH, path)
result = re.sub(pattern, re_format, input_str, flags=re.M)
return result
关于这个规则如果看到的你有更好的改进方案 , 我很乐意修正这个实现细节
class ModifyEnum(enum.Enum):
"""
规范: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-git-diff-filesltpatterngt82308203
下述修改我们
知道怎么触发的标记为 [√]
不知道怎么触发的标记为 [x] //未成功测试处理的修改类型, 通过 git diff 文档给定的格式进行操作
[√] A: addition of a file
[x] C: copy of a file into a new one
[√] D: deletion of a file
[√] M: modification of the contents or mode of a file
[√] R: renaming of a file
[x] T: change in the type of the file
[x] U: file is unmerged (you must complete the merge before it can be committed)
[x] X: "unknown" change type (most probably a bug, please report it)
"""
modify_addition = 'A'
modify_copy = 'C'
modify_deletion = 'D'
modify_modification = 'M'
modify_renaming = 'R'
modify_file_is_unmerged = 'U'
modify_change_type = 'T'
modify_unknown = 'X'
如果想查看实现细节或者自己有兴趣实现一次 , .github
文件中留有各种文件和说明
我看是有简单的给人用的方式的, 我还没学会, 又不想学了, 但是现在简单的方式又不够优雅, 真实矛盾:
.github/workflows/github_host.yml
文件的 ISSUES_MAP_FILE_NUMBER: '9'
.github/github_actions/issues_config.json
ISSUES_FOOTER_PATH: '.github/github_actions/issues_footer.md'
ISSUES_HEADER_PATH: '.github/github_actions/issues_header.md'
yml
居中调度install_dependence_xxx.sh
安装依赖 (python . 等)git_action_practice.py
实现从 repository 到 issue 的负值粘贴git_action_practice.py
细节pygithub
和 requsts
调用 github api
git log
获取仓库变化时间和 哈希git diff
根据按仓库变化的 哈希 获取变化的文件路径和repository : issue
的文件映射持久化到 一个指定的 issue 中(json 格式) .commit hash
证明文件链接有一定可用性
证明图片链接有一定可用性
{
"last_success_opt_commit_log_line_key": "767ba8db9cbb98f37fec291ce9abb09cb0ff77d9···@/@···2020-05-31 12:45:43 +0800···@/@···开放私钥 debug 文件, 并删除 私钥",
"issues_dictionary_map_key": {
".github/github_actions/test2.py": 32,
".github/github_actions/test_python.py": 33,
"README.md": 45
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.