Skip to content

Commit

Permalink
🚀 Commit by: byeaxj <[email protected]>
Browse files Browse the repository at this point in the history
📝 Changes:
M  .obsidian/workspace.json
M  beiklive/.vuepress/config.ts
M  deploy.sh
AM githubpush.py
  • Loading branch information
byeaxj committed May 9, 2024
1 parent 7b0df45 commit 77f25b4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,17 @@
},
"active": "da9ca8a590533596",
"lastOpenFiles": [
"githubpush.py",
"githubpush.bat",
"githubpush copy.sh",
"githubpush.sh",
"node_modules/gitalk/node_modules/date-fns/fp/lastDayOfQuarter/index.js",
"node_modules/gitalk/node_modules/date-fns/fp/lastDayOfQuarter/package.json",
"node_modules/gitalk/node_modules/date-fns/fp/lastDayOfQuarter/index.js.flow",
"node_modules/gitalk/node_modules/date-fns/fp/lastDayOfQuarter/index.d.ts",
"node_modules/gitalk/node_modules/date-fns/fp/lastDayOfQuarter",
"node_modules/gitalk/node_modules/date-fns/fp/isWithinInterval/package.json",
"node_modules/gitalk/node_modules/date-fns/fp/isWithinInterval/index.js.flow",
"node_modules/gitalk/node_modules/date-fns/fp/isWithinInterval/index.js",
"node_modules/gitalk/node_modules/date-fns/fp/isWithinInterval/index.d.ts",
"node_modules/gitalk/node_modules/date-fns/fp/isWithinInterval",
"node_modules/gitalk/node_modules/date-fns/esm/locale/uk/_lib/localize/index.js",
"beiklive/Note_obsidian/01.插件推荐.md",
"beiklive/02.记录/02.折腾记录/00.obsidian.md",
"beiklive/02.记录/01.工具使用/01.Git.md",
Expand Down
6 changes: 3 additions & 3 deletions beiklive/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
'/': {
lang: 'zh-CN',
title: "beiklive's blog",
description: 'web前端技术博客,专注web前端学习与总结。JavaScript,js,ES6,TypeScript,vue,React,python,css3,html5,Node,git,github等技术文章。',
description: '懒狗的摸鱼日记',
}
},
base: '/vuepresswiki/',
Expand Down Expand Up @@ -192,7 +192,7 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
footer: {
createYear: 2024, // 博客创建年份
copyrightInfo:
'beiklive | <a href="https://github.com/beiklive/vuepress-theme-vdoing/blob/master/LICENSE" target="_blank">MIT License</a>', // 博客版权信息、备案信息等,支持a标签或换行标签</br>
'beiklive | <a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">苏ICP备20038092号-2</a>', // 博客版权信息、备案信息等,支持a标签或换行标签</br>
},

// 扩展自动生成frontmatter。(当md文件的frontmatter不存在相应的字段时将自动添加。不会覆盖已有的数据。)
Expand All @@ -214,7 +214,7 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
'meta',
{
name: 'keywords',
content: '前端博客,个人技术博客,前端,前端开发,前端框架,web前端,前端面试题,技术文档,学习,面试,JavaScript,js,ES6,TypeScript,vue,python,css3,html5,Node,git,github,markdown',
content: '后端博客,个人技术博客,C++,linux,qt,python,技术文档,学习,vue,python,css3,html5,Node,git,github,markdown',
},
],
['meta', { name: 'baidu-site-verification', content: '7F55weZDDc' }], // 百度统计的站长验证(你可以去掉)
Expand Down
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -e


push_addr=https://github.com/beiklive/beiklive.github.io # git提交地址,也可以手动设置,比如:[email protected]:xugaoyi/vuepress-theme-vdoing.git
push_addr=`git remote get-url --push origin` # git提交地址,也可以手动设置,比如:[email protected]:xugaoyi/vuepress-theme-vdoing.git
commit_info=`git describe --all --always --long`
dist_path=beiklive/.vuepress/dist # 打包生成的文件夹路径
push_branch=gh-pages # 推送的分支
Expand Down
46 changes: 46 additions & 0 deletions githubpush.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import subprocess

def get_git_user_info():
# 获取用户姓名和邮箱
user_name = subprocess.check_output(['git', 'config', 'user.name']).strip().decode()
user_email = subprocess.check_output(['git', 'config', 'user.email']).strip().decode()
return user_name, user_email

def get_git_status():
# 获取文件变更信息
git_status = subprocess.check_output(['git', 'status', '--porcelain', '--untracked-files=all']).strip().decode()
return git_status

def format_commit_message(user_name, user_email, diff_info):
# 构造提交信息
commit_message = f"🚀 Commit by: {user_name} <{user_email}>\n\n"
commit_message += "📝 Changes:\n"
commit_message += diff_info
return commit_message

def main():
try:
# 获取用户姓名和邮箱
user_name, user_email = get_git_user_info()

# 获取文件变更信息
diff_info = get_git_status()

# 格式化提交信息
final_commit_message = format_commit_message(user_name, user_email, diff_info)

# 添加所有修改的文件到暂存区
subprocess.run(['git', 'add', '-A'])

# 提交到本地仓库
subprocess.run(['git', 'commit', '-m', final_commit_message])

# 推送到远程仓库
# subprocess.run(['git', 'push'])

print("提交完成!")
except subprocess.CalledProcessError as e:
print(f"出现错误:{e}")

if __name__ == "__main__":
main()

0 comments on commit 77f25b4

Please sign in to comment.