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
|
|
|
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:34:20 +00:00
|
|
|
with:
|
2025-01-15 10:36:10 +00:00
|
|
|
ref: ${{ github.head_ref }}
|
2025-01-15 10:19:32 +00:00
|
|
|
|
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]"
|
|
|
|
|
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"
|
2025-01-15 10:34:20 +00:00
|
|
|
|
|
|
|
- name: Push changes with API keys
|
|
|
|
env:
|
|
|
|
JSON_API_ID: ${{ secrets.JSON_API_ID }}
|
|
|
|
JSON_API_KEY: ${{ secrets.JSON_API_KEY }}
|
|
|
|
run: |
|
|
|
|
git remote set-url origin https://$JSON_API_ID:$JSON_API_KEY@github.com/${{ github.repository }}.git
|
2025-01-15 10:32:11 +00:00
|
|
|
git push
|