move ts files to new repo in wa #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate JSON on Push or PR | |
on: [workflow_dispatch, push] | |
jobs: | |
generate-json: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
if: ${{ github.actor != 'github-actions[bot]' && github.event_name != 'push' || github.event.pusher.name != 'github-actions[bot]' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # needed for full meta history | |
- name: Set git config | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '[email protected]' | |
git config --global core.quotePath false | |
- name: Get dates meta | |
run: | | |
json="{" | |
dates=$(git ls-tree -r --name-only HEAD | grep -v '/\.' | grep -v '^\.' | while read -r filename; do | |
date=$(git log -1 --format="%aI" -- "$filename") | |
printf "\"${filename}\": \"${date}\", " | |
done) | |
json+=${dates} | |
json=${json%, } | |
json+="}" | |
echo "$json" > metadata.json | |
- name: Display metadata.json content | |
run: cat metadata.json | |
- name: Commit if different | |
run: | | |
git add metadata.json | |
git commit -m "Automated Update of metadata.json with latest file dates" | |
git push |