Skip to content

Merge branch 'master' of https://github.com/WycliffeAssociates/TS-bie… #6

Merge branch 'master' of https://github.com/WycliffeAssociates/TS-bie…

Merge branch 'master' of https://github.com/WycliffeAssociates/TS-bie… #6

Workflow file for this run

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