mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-04 06:50:15 +00:00
Update check_and_update_json_date.yml
This commit is contained in:
parent
37da2e5e1c
commit
aa3a3997f0
@ -33,11 +33,15 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
TODAY=$(date -u +%Y-%m-%d)
|
TODAY=$(date -u +%Y-%m-%d)
|
||||||
for json_file in $(find . -type f -name "*.json"); do
|
for json_file in $(find . -type f -name "*.json"); do
|
||||||
jq --arg today "$TODAY" '.date_created = $today' "$json_file" > tmp.json && mv tmp.json "$json_file"
|
# 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
|
done
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
run: |
|
run: |
|
||||||
git add *.json
|
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
|
git push origin main
|
||||||
|
Loading…
Reference in New Issue
Block a user