ProxmoxVE/.github/workflows/check_and_update_json_date.yml

43 lines
1.1 KiB
YAML
Raw Normal View History

2025-01-15 09:37:30 +00:00
name: Update JSON and Push Changes
on:
2025-01-15 09:37:30 +00:00
push:
branches:
- main
jobs:
2025-01-15 09:37:30 +00:00
update-json:
runs-on: ubuntu-latest
steps:
2025-01-15 09:37:30 +00:00
- name: Check out repository
uses: actions/checkout@v3
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
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-15 09:37:30 +00:00
- name: Commit changes
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