File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ name: Update JSON Date in PR
33on :
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
1312jobs :
1413 update_json :
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
You can’t perform that action at this time.
0 commit comments