-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 Commit by: byeaxj <[email protected]>
📝 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
Showing
4 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 # 推送的分支 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |