1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00
ProxmoxVE/.github/workflows/check_and_update_json_date.yml

34 lines
873 B
YAML
Raw Normal View History

2025-01-15 11:04:03 +01:00
name: Update Date Created in PR
on:
2025-01-15 10:50:30 +01:00
pull_request:
2025-01-15 11:04:03 +01:00
paths:
- '*.json'
types: [opened, synchronize]
2025-01-15 11:09:31 +01:00
workflow_dispatch:
jobs:
2025-01-15 11:04:03 +01:00
update-date:
runs-on: ubuntu-latest
2025-01-15 11:04:03 +01:00
steps:
2025-01-15 10:59:01 +01:00
- name: Checkout PR branch
2025-01-15 10:40:38 +01:00
uses: actions/checkout@v4
2025-01-15 10:50:30 +01:00
with:
2025-01-15 11:04:03 +01:00
ref: ${{ github.head_ref }}
2025-01-15 10:25:38 +01:00
2025-01-15 11:04:03 +01:00
- name: Install yq
2025-01-15 10:40:38 +01:00
run: |
2025-01-15 11:04:03 +01:00
curl -sSL https://github.com/mikefarah/yq/releases/download/v4.18.1/yq_linux_amd64 -o /usr/local/bin/yq
chmod +x /usr/local/bin/yq
2025-01-15 10:40:38 +01:00
2025-01-15 11:04:03 +01:00
- name: Update date_created in JSON
run: |
2025-01-15 10:25:38 +01:00
TODAY=$(date -u +%Y-%m-%d)
2025-01-15 11:04:03 +01:00
yq e '.date_created = strftime("%Y-%m-%d")' -i your_file.json
2025-01-15 10:59:01 +01:00
- name: Commit changes if necessary
run: |
2025-01-15 11:04:03 +01:00
git status
2025-01-15 10:59:01 +01:00
git diff --quiet || (git commit -m "Update date_created to $TODAY" && git push origin ${{ github.head_ref }})