Skip to content

Commit a71bdb6

Browse files
authored
Update update_json_date.yml
1 parent f6bc82e commit a71bdb6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/update_json_date.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Auto Update JSON-Dates
1+
name: Auto Update JSON-Dateien (new files only)
22

33
on:
44
push:
@@ -25,7 +25,7 @@ jobs:
2525
- name: Checkout repository
2626
uses: actions/checkout@v4
2727
with:
28-
fetch-depth: 0 # Fetch full history for commit checks
28+
fetch-depth: 0 # Full history to check commit timestamps
2929

3030
- name: Set up Git
3131
run: |
@@ -36,11 +36,12 @@ jobs:
3636
id: find_new_json
3737
run: |
3838
TODAY=$(date -u +"%Y-%m-%d")
39-
> new_json_files.txt
40-
4139
git fetch origin main --depth=1
40+
LATEST_COMMIT=$(git rev-parse origin/main)
41+
42+
> new_json_files.txt
4243
43-
for FILE in $(git log --since="$TODAY 00:00:00" --diff-filter=A --name-only --pretty=format: origin/main -- json/*.json || true); do
44+
for FILE in $(git diff --diff-filter=A --name-only $LATEST_COMMIT -- json/); do
4445
COMMIT_DATE=$(git log --format=%cI -- "$FILE" | tail -n 1 | cut -dT -f1)
4546
if [[ "$COMMIT_DATE" == "$TODAY" ]]; then
4647
echo "$FILE" >> new_json_files.txt
@@ -56,9 +57,9 @@ jobs:
5657
- name: Run update script
5758
if: env.CHANGED == 'true'
5859
run: |
59-
chmod +x .github/workflows/scripts/update-json.sh
60+
chmod +x .github/scripts/update-json.sh
6061
while read -r FILE; do
61-
.github/workflows/scripts/update-json.sh "$FILE"
62+
.github/scripts/update-json.sh "$FILE"
6263
done < new_json_files.txt
6364
6465
- name: Commit and create PR if changes exist

0 commit comments

Comments
 (0)