2025-01-15 09:37:30 +00:00
|
|
|
name: Update JSON and Push Changes
|
2025-01-10 12:36:20 +00:00
|
|
|
|
|
|
|
on:
|
2025-01-15 09:37:30 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2025-01-10 12:36:20 +00:00
|
|
|
|
|
|
|
jobs:
|
2025-01-15 09:37:30 +00:00
|
|
|
update-json:
|
2025-01-10 12:36:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2025-01-15 09:37:30 +00:00
|
|
|
- name: Check out repository
|
|
|
|
uses: actions/checkout@v3
|
2025-01-10 12:36:20 +00:00
|
|
|
|
2025-01-15 09:37:30 +00:00
|
|
|
- name: Authenticate with GitHub App
|
|
|
|
uses: tibdex/github-app-token@v1
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.JSON_APP_ID }}
|
|
|
|
private_key: ${{ secrets.JSON_APP_KEY }}
|
2025-01-15 09:25:38 +00:00
|
|
|
|
2025-01-15 09:37:30 +00:00
|
|
|
- name: Modify JSON file
|
2025-01-10 12:36:20 +00:00
|
|
|
run: |
|
2025-01-15 09:37:30 +00:00
|
|
|
JSON_FILE="json/mailrise.json"
|
2025-01-15 09:25:38 +00:00
|
|
|
TODAY=$(date -u +%Y-%m-%d)
|
2025-01-15 09:37:30 +00:00
|
|
|
|
|
|
|
if [ -f "$JSON_FILE" ]; then
|
|
|
|
echo "Updating date_created in $JSON_FILE to $TODAY"
|
|
|
|
jq --arg today "$TODAY" '.date_created = $today' $JSON_FILE > tmp.json && mv tmp.json $JSON_FILE
|
|
|
|
else
|
|
|
|
echo "File $JSON_FILE does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
2025-01-10 12:36:20 +00:00
|
|
|
|
2025-01-15 09:37:30 +00:00
|
|
|
- name: Commit changes
|
2025-01-10 12:36:20 +00:00
|
|
|
run: |
|
2025-01-15 09:37:30 +00:00
|
|
|
git config user.name "github-actions[bot]"
|
|
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
git add json/mailrise.json
|
|
|
|
git commit -m "Update date_created in mailrise.json to $TODAY"
|
|
|
|
git push origin main
|
|
|
|
|