Update check_and_update_json_date.yml

This commit is contained in:
CanbiZ 2025-01-15 10:45:22 +01:00 committed by GitHub
parent 37da2e5e1c
commit aa3a3997f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,11 +33,15 @@ jobs:
run: |
TODAY=$(date -u +%Y-%m-%d)
for json_file in $(find . -type f -name "*.json"); do
# Ensure the JSON structure is an object
if jq -e 'type == "object"' "$json_file" > /dev/null 2>&1; then
# Update the date_created field
jq --arg today "$TODAY" '.date_created = $today' "$json_file" > tmp.json && mv tmp.json "$json_file"
fi
done
- name: Commit changes
run: |
git add *.json
git commit -m "Update date_created in JSON files to $TODAY"
git commit -m "Update date_created to $TODAY"
git push origin main