Skip to content

Commit

Permalink
ci/cd: update date in data file added.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahagens committed Jul 2, 2024
1 parent 822ce81 commit be90b01
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/update-date.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Update Date in data.json

on:
push:
branches:
- main

jobs:
update-date:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Update date in data.json
run: |
current_date=$(date +'%Y.%-m.%-d')
sed -i 's/"date": "[0-9]\{4\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}"/"date": "'"$current_date"'"/' docs/data.json
- name: Commit and push if changed
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add docs/data.json
git diff --quiet && git diff --staged --quiet || (git commit -m "Update date in data.json" && git push)

0 comments on commit be90b01

Please sign in to comment.