From f03471133e82a2a68049d845dd039721e39b14d6 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:40:06 +0100 Subject: [PATCH] Update update_json_date.yml --- .github/workflows/update_json_date.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_json_date.yml b/.github/workflows/update_json_date.yml index d9968835..10bfd140 100644 --- a/.github/workflows/update_json_date.yml +++ b/.github/workflows/update_json_date.yml @@ -24,16 +24,24 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 2 # Ensure we have at least the last commit for comparison - name: Set up Git run: | git config --global user.name "GitHub Actions" git config --global user.email "github-actions[bot]@users.noreply.github.com" - - name: Find newly added JSON files + - name: Find newly added JSON files (created today) id: find_new_json run: | - NEW_JSON_FILES=$(git diff --diff-filter=A --name-only HEAD~1 -- json/*.json || true) + TODAY=$(date -u +"%Y-%m-%d") + + # Fetch latest main for proper diff + git fetch origin main --depth=1 + + # Find new JSON files added today + NEW_JSON_FILES=$(git log --since="$TODAY 00:00:00" --diff-filter=A --name-only --pretty=format: origin/main -- json/*.json || true) if [[ -z "$NEW_JSON_FILES" ]]; then echo "CHANGED=false" >> $GITHUB_ENV