Skip to content

Commit

Permalink
Update check_and_update_json_date.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MickLesk authored Jan 10, 2025
1 parent 70ab9ab commit d8931fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check_and_update_json_date.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Check and Update JSON Date

on:
pull_request:
types: [synchronize, opened, edited]
types: [synchronize, opened, reopened, edited]

jobs:
update-date:
Expand All @@ -20,10 +20,10 @@ jobs:
- name: Install dependencies
run: pip install jq

- name: Find and Update JSON files
- name: Find and Update JSON files in /json folder
run: |
TODAY=$(date +%Y-%m-%d)
for file in $(git diff --diff-filter=A --name-only HEAD | grep '\.json$'); do
for file in $(git diff --diff-filter=A --name-only HEAD | grep '^json/.*\.json$'); do
if jq -e '.date_created' $file > /dev/null 2>&1; then
echo "Updating date_created in $file"
jq --arg date "$TODAY" '.date_created = $date' $file > temp.json && mv temp.json $file
Expand Down

0 comments on commit d8931fe

Please sign in to comment.