Skip to content

Commit e4774fe

Browse files
authored
Update sync.yaml
1 parent 4873643 commit e4774fe

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/sync.yaml

+22-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ jobs:
4242
# 克隆源仓库的特定分支
4343
git clone --depth 1 --single-branch --branch "$branch" "$repo_url" "$temp_dir"
4444
45+
# 获取源仓库最新提交信息
46+
cd "$temp_dir"
47+
latest_commit_hash=$(git log -1 --format="%H")
48+
latest_commit_date=$(git log -1 --format="%ad" --date=iso)
49+
latest_commit_msg=$(git log -1 --format="%s")
50+
cd - > /dev/null
51+
52+
echo "Latest commit in $repo_url ($branch):"
53+
echo " Hash: $latest_commit_hash"
54+
echo " Date: $latest_commit_date"
55+
echo " Message: $latest_commit_msg"
56+
4557
# 确保目标目录存在
4658
mkdir -p "$dest"
4759
@@ -69,7 +81,16 @@ jobs:
6981
# 如果有变更,添加到 git
7082
if [[ `git status "$dest" --porcelain` ]]; then
7183
git add "$dest"
72-
git commit -m "Update $dest from $repo_url ($branch:$src_path)" || true
84+
85+
# 创建包含源仓库更新时间的提交消息
86+
commit_msg="Update $dest from $repo_url ($branch:$src_path)
87+
88+
Source commit: $latest_commit_hash
89+
Update time: $latest_commit_date
90+
Commit message: $latest_commit_msg
91+
Synced at: $(date -u "+%Y-%m-%d %H:%M:%S UTC")"
92+
93+
git commit -m "$commit_msg" || true
7394
echo "Changes committed for $dest"
7495
else
7596
echo "No changes for $dest"

0 commit comments

Comments
 (0)