From 8c8fcf9f8dc909857c4f14e0ffae0f7c5d067afd Mon Sep 17 00:00:00 2001 From: Parsast Date: Sun, 12 Jul 2026 13:21:03 +0330 Subject: [PATCH] fix workflow leaking commit timezone --- .../modify-last-modified-timestamp.yaml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/modify-last-modified-timestamp.yaml b/.github/workflows/modify-last-modified-timestamp.yaml index dd9a0e0d..b13c5e58 100644 --- a/.github/workflows/modify-last-modified-timestamp.yaml +++ b/.github/workflows/modify-last-modified-timestamp.yaml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true jobs: - patch: + modify: name: modify runs-on: ubuntu-latest steps: @@ -24,18 +24,9 @@ jobs: - name: Modify last-updated field run: | - for f in $(git ls-files *.txt); do - COMMIT_DATE=$(git log -1 --format=%aD $f) - AUTHOR=$(git log -1 --pretty=format:%an $f) - - # Skip commits made by GitHub Actions bot - if [[ "$AUTHOR" == "github-actions[bot]" ]]; then - continue - fi - - if sed --version >/dev/null 2>&1; then - sed -i "0,/^! Last modified: /s|^! Last modified: .*|! Last modified: $COMMIT_DATE|" "$f" - fi + DATE=$(date -Ru) + for f in $(git diff HEAD~1 --name-only); do + sed -i "0,/^! Last modified: /s/^\(! Last modified: \).*/\1$DATE/" $f done - name: Commit changes (if any)