Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions .github/workflows/modify-last-modified-timestamp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true

jobs:
patch:
modify:
name: modify
runs-on: ubuntu-latest
steps:
Expand All @@ -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)
Expand Down