-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: store backup in another branch #253
base: master
Are you sure you want to change the base?
Conversation
很抱歉前段时间学校里事情太多忙忘了,这样应该符合要求了。 |
之后您需要新建一个分支专门存放 BACKUP 目录等,可以将 master 分支里的您还需要的文件移动到新分支。大体可以参考我的仓库 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有些需要修改的
cp back/README.md main/README.md | ||
cp back/feed.xml main/feed.xml | ||
cd main | ||
git config --local user.email "${{ env.GITHUB_EMAIL }}" | ||
git config --local user.name "${{ env.GITHUB_NAME }}" | ||
git add BACKUP/*.md | ||
git commit -a -m 'update new blog' || echo "nothing to commit" | ||
git push || echo "nothing to push" | ||
|
||
git add README.md feed.xml | ||
git commit --amend --no-edit | ||
git push --force | ||
cd ../back | ||
git config --local user.email "${{ env.GITHUB_EMAIL }}" | ||
git config --local user.name "${{ env.GITHUB_NAME }}" | ||
git add . | ||
git commit -m "update new blog" | ||
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥这么复杂。。。
MD_FOOT = """ | ||
--- | ||
Thanks for [yihong0618](https://github/com/yihong0618/gitblog) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这句可以不要哈哈,不过没关系,我自己来改也行
[RSS Feed](https://raw.githubusercontent.com/{repo_name}/master/feed.xml) | ||
MD_HEAD = """# Gitblog | ||
My personal blog using issues and GitHub Actions(随意转载,无需署名) | ||
Subscribe to [RSS Feed](https://raw.githubusercontent.com/{repo_name}/master/feed.xml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 repo_name 是变量?
|
||
|
||
def add_md_top(repo, md, me): | ||
top_issues = list(get_top_issues(repo)) | ||
if not TOP_ISSUES_LABELS or not top_issues: | ||
return | ||
with open(md, "a+", encoding="utf-8") as md: | ||
md.write("## 置顶文章\n") | ||
md.write("\n## 置顶文章\n\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 Label 不是有么?不加这个也行吧?
md.write("\n## 友情链接\n\n") | ||
md.write(s) | ||
md.write("\n> 通过向以下 issues 评论的形式,将您的博客加入友链列表\n> \n") | ||
for issue in friends_issues: | ||
md.write(f"> [{issue.title}]({issue.html_url})\n> \n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个很棒,谢谢
friends_issues = repo.get_issues(labels=FRIENDS_LABELS) | ||
if not FRIENDS_LABELS or not friends_issues: | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
|
||
|
||
def add_md_recent(repo, md, me, limit=5): | ||
count = 0 | ||
with open(md, "a+", encoding="utf-8") as md: | ||
# one the issue that only one issue and delete (pyGitHub raise an exception) | ||
try: | ||
md.write("## 最近更新\n") | ||
md.write("\n## 最近更新\n\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
if issues.totalCount: | ||
md.write("## " + label.name + "\n") | ||
issues = sorted(issues, key=lambda x: x.created_at, reverse=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉得我之前的方式比较好,用 label 当 title
我懂了,这个我需要考虑下,我想保持原有的 |
没关系,哈哈。 有几个我不想动的,你的可以作为 fork 继续更新,因为这个本质上还是私人项目我没有特别想做的通用
如果你想用你的项目提 PR, 你可以研究下怎么同步我的然后切分支提,这样就没那么多冲突了 |
save backups in new branch, and do not change commit log in master branch