Update subdirectories.json #12
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: Generate Subdirectory List | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| with: | |
| persist-credentials: false | |
| - name: Generate subdirectories.json | |
| run: | | |
| echo "[" > subdirectories.json | |
| for dir in */ ; do | |
| if [[ "$dir" != "assets/" && "$dir" != ".github/" ]]; then | |
| echo " \"${dir%/}\"," >> subdirectories.json | |
| fi | |
| done | |
| sed -i '$ s/,$//' subdirectories.json | |
| echo "]" >> subdirectories.json | |
| - name: Commit and push changes | |
| env: | |
| TOKEN: ${{ secrets.SUBDIRECTORYFETCHINGTOKEN }} | |
| run: | | |
| git config --global user.name "Auto Commit Bot" | |
| git config --global user.email "[email protected]" | |
| git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} | |
| git add subdirectories.json | |
| git commit -m "Update subdirectories list" || echo "No changes" | |
| git push origin main || (echo "==== GIT PUSH FAILED ====" && git remote -v && git status && exit 1) |