June 2025 tally (#68) #75
This file contains hidden or 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: Update Files JSON | |
on: | |
push: | |
paths: | |
- "site/data/*.csv" # Trigger only when CSV files in the data folder are added/modified | |
jobs: | |
generate-json: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up bash environment | |
- name: Set up shell environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y bash | |
# Step 3: Run the bash script | |
- name: Generate files.json | |
run: | | |
chmod +x ./scripts/generate_file_json.sh | |
./scripts/generate_file_json.sh | |
# Step 4: Check if there are changes | |
- name: Check for changes | |
id: changes | |
run: | | |
git add ./site/data/files.json | |
git diff --cached --quiet || echo "has_changes=true" >> $GITHUB_ENV | |
# Step 5: Commit and push changes (if any) | |
- name: Commit and push changes | |
if: env.has_changes == 'true' | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -m "Update files.json after new CSV upload" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |