Skip to content

Commit a62491a

Browse files
authored
Merge pull request #645 from tsubasakat/ci/auto-update-last-modified-date
Add step to CI workflow
2 parents 7b5ec04 + 03f9a10 commit a62491a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4
20+
21+
- name: Update last modified dates
22+
run: |
23+
# 現在の日付を取得 (JST)
24+
current_date=$(TZ=Asia/Tokyo date '+%Y/%m/%d')
25+
26+
# .md ファイルの最終更新日コメントを更新
27+
find . -name "*.md" -type f -exec grep -l "最終更新日" {} \; | while read file; do
28+
echo "Updating date in: $file"
29+
sed -i "s|<!--最終更新日: [0-9/]*[[:space:]]*-->|<!--最終更新日: $current_date -->|g" "$file"
30+
done
31+
32+
# 変更があった場合のみコミット
33+
if ! git diff --quiet; then
34+
git config --local user.email "[email protected]"
35+
git config --local user.name "GitHub Action"
36+
git add .
37+
git commit -m "自動更新: 最終更新日を $current_date に更新"
38+
git push
39+
else
40+
echo "No changes to commit"
41+
fi
2042
2143
- name: Setup Node
2244
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)