2025-01-15 10:27:53 +00:00
|
|
|
name: Update JSON Date in PR
|
2025-01-15 10:19:32 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2025-01-15 10:27:53 +00:00
|
|
|
paths:
|
|
|
|
- 'json/*.json'
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
|
2025-01-15 10:19:32 +00:00
|
|
|
schedule:
|
2025-01-15 10:32:11 +00:00
|
|
|
- cron: '0 */2 * * *' # Alle 2 Stunden
|
2025-01-15 10:19:32 +00:00
|
|
|
|
|
|
|
jobs:
|
2025-01-15 10:27:53 +00:00
|
|
|
update_json:
|
2025-01-15 10:19:32 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2025-01-15 10:27:53 +00:00
|
|
|
- name: Check out repository
|
2025-01-15 10:19:32 +00:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2025-01-15 10:32:11 +00:00
|
|
|
- name: Configure Git user
|
|
|
|
run: |
|
|
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config --global user.name "github-actions[bot]"
|
|
|
|
|
|
|
|
- name: Get the PR branch
|
|
|
|
run: |
|
|
|
|
echo "Fetching PR branch"
|
|
|
|
PR_BRANCH=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")
|
|
|
|
echo "PR Branch is $PR_BRANCH"
|
|
|
|
|
|
|
|
- name: Checkout PR branch
|
|
|
|
run: git checkout $PR_BRANCH
|
|
|
|
|
2025-01-15 10:27:53 +00:00
|
|
|
- name: Make script executable
|
|
|
|
run: chmod +x .github/workflows/scripts/update_json_date.sh
|
2025-01-15 10:19:32 +00:00
|
|
|
|
2025-01-15 10:27:53 +00:00
|
|
|
- name: Run the update script
|
|
|
|
run: ./.github/workflows/scripts/update_json_date.sh
|
2025-01-15 10:32:11 +00:00
|
|
|
|
|
|
|
- name: Commit changes if updated
|
|
|
|
run: |
|
|
|
|
git add *.json
|
|
|
|
git diff --cached --quiet || git commit -m "Update JSON dates"
|
|
|
|
git push
|
|
|
|
continue-on-error: true
|