ProxmoxVE/.github/workflows/check_and_update_json_date.yml
2025-01-15 11:04:03 +01:00

33 lines
852 B
YAML

name: Update Date Created in PR
on:
pull_request:
paths:
- '*.json'
types: [opened, synchronize]
jobs:
update-date:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install yq
run: |
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
- name: Update date_created in JSON
run: |
TODAY=$(date -u +%Y-%m-%d)
yq e '.date_created = strftime("%Y-%m-%d")' -i your_file.json
- name: Commit changes if necessary
run: |
git status
git diff --quiet || (git commit -m "Update date_created to $TODAY" && git push origin ${{ github.head_ref }})