Generate Folder List #3
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 Folder List | |
on: | |
schedule: | |
- cron: '*/5 * * * *' # Runs at every 5th minute | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
generate-and-commit-folder-list: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # Use the Node.js version that matches your project requirements | |
- name: Install dependencies | |
run: npm install | |
- name: Run the script to fetch folders and generate the the JSON file | |
run: node .scripts/fetchFolders.js | |
- name: Commit and push changes if there are any | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Kkundan" | |
git add static/folderList.json | |
git commit -m "Automatically update folder list" -a || echo "No changes to commit" | |
git push |