-
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.
- Loading branch information
Showing
3 changed files
with
520 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Load existing dates.json into a variable | ||
if [[ -f "metadata.json" ]]; then | ||
json=$(<dates.json) | ||
else | ||
json="{}" # Start with an empty JSON if dates.json doesn't exist | ||
fi | ||
|
||
# Use jq to ensure json is formatted correctly | ||
json=$(echo "$json" | jq '.') | ||
|
||
# Get modified files in the current commit | ||
modified_files=$(git diff --name-only HEAD~1 HEAD) | ||
|
||
# Update dates for modified files only | ||
for filename in $modified_files; do | ||
# Only proceed if file exists in repo and isn't hidden or in hidden folders | ||
if [[ -f "$filename" ]] && [[ ! "$filename" =~ ^\. ]] && [[ ! "$filename" =~ /\. ]]; then | ||
date=$(git log -1 --format="%aI" -- "$filename") | ||
# Update the JSON object with the new date for the modified file | ||
json=$(echo "$json" | jq --arg file "$filename" --arg date "$date" '.[$file] = $date') | ||
fi | ||
done | ||
|
||
# Save the updated JSON to metadata.json | ||
echo "$json" > metadata.json |
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 |
---|---|---|
@@ -1 +1 @@ | ||
Change whatever locally | ||
Change whatever locally d |
Large diffs are not rendered by default.
Oops, something went wrong.