Update main.py #26
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: Convert Audio to MakeCode | |
| on: | |
| push: | |
| paths: | |
| - "audio/**" | |
| - "main.py" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| pip install numpy scipy | |
| - name: Create output folder | |
| run: mkdir -p output | |
| - name: Convert all WAV files to MakeCode | |
| run: | | |
| for file in audio/*.wav; do | |
| [ -f "$file" ] || continue | |
| base=$(basename "$file" .wav) | |
| python main.py -i "$file" -o "output/${base}.ts" | |
| done | |
| - name: Commit and push generated files | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add output/*.ts | |
| git commit -m "Auto-generate MakeCode audio files" || echo "No changes to commit" | |
| git push --force |