Skip to content

Commit 5c16955

Browse files
authored
Update update_json_date.yml
1 parent 2c8aab2 commit 5c16955

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

.github/workflows/update_json_date.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ name: Update JSON Date in PR
33
on:
44
pull_request:
55
paths:
6-
- '.github/workflows/scripts/*.sh'
76
- 'json/*.json'
87
types: [opened, synchronize, reopened]
98

109
schedule:
11-
- cron: '0 */2 * * *'
10+
- cron: '0 */2 * * *' # Alle 2 Stunden
1211

1312
jobs:
1413
update_json:
@@ -18,8 +17,29 @@ jobs:
1817
- name: Check out repository
1918
uses: actions/checkout@v4
2019

20+
- name: Configure Git user
21+
run: |
22+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
23+
git config --global user.name "github-actions[bot]"
24+
25+
- name: Get the PR branch
26+
run: |
27+
echo "Fetching PR branch"
28+
PR_BRANCH=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")
29+
echo "PR Branch is $PR_BRANCH"
30+
31+
- name: Checkout PR branch
32+
run: git checkout $PR_BRANCH
33+
2134
- name: Make script executable
2235
run: chmod +x .github/workflows/scripts/update_json_date.sh
2336

2437
- name: Run the update script
2538
run: ./.github/workflows/scripts/update_json_date.sh
39+
40+
- name: Commit changes if updated
41+
run: |
42+
git add *.json
43+
git diff --cached --quiet || git commit -m "Update JSON dates"
44+
git push
45+
continue-on-error: true

0 commit comments

Comments
 (0)