Feat/music release tracker #6
Workflow file for this run
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: Check music releases | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - opened | |
| - edited | |
| - reopened | |
| - synchronize | |
| jobs: | |
| check-music-releases: | |
| runs-on: self-hosted | |
| env: | |
| ARTIST: "Imagine Dragons" | |
| TRACKS: | | |
| Radioactive | |
| Demons | |
| Warriors | |
| Bones | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Yandex Music | |
| run: | | |
| python scripts/music-release-tracker/yandex-music/main.py | |
| cat dict.yaml | |
| - name: Spotify | |
| env: | |
| SPOTIFY_TOKEN: ${{ secrets.SPOTIFY_TOKEN }} | |
| run: | | |
| echo "TODO: get spotify token" | |
| # python scripts/music-release-tracker/spotify/main.py | |
| # cat dict.yaml | |
| - name: Apple Music | |
| run: | | |
| python scripts/music-release-tracker/apple-music/main.py | |
| cat dict.yaml | |
| - name: YouTube Music | |
| env: | |
| YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
| run: | | |
| python scripts/music-release-tracker/youtube-music/main.py | |
| cat dict.yaml | |
| - name: Music summary | |
| run: | | |
| python - << 'EOF' >> "$GITHUB_STEP_SUMMARY" | |
| import json | |
| with open("dict.yaml", "r", encoding="utf-8") as f: | |
| data = json.load(f) | |
| platforms = set() | |
| for v in data.values(): | |
| platforms.update(v.keys()) | |
| platforms = sorted(platforms) | |
| def fmt_status(val): | |
| if val == 1: | |
| return "✅" | |
| if val == 0: | |
| return "❌" | |
| return "⚠️ unknown" | |
| print("## Music availability\n") | |
| header = "| Track | " + " | ".join(platforms) + " |" | |
| sep = "| --- | " + " | ".join(["---"] * len(platforms)) + " |" | |
| print(header) | |
| print(sep) | |
| for track in sorted(data.keys()): | |
| row = [track] | |
| for p in platforms: | |
| val = data[track].get(p, "unknown") | |
| row.append(fmt_status(val)) | |
| print("| " + " | ".join(row) + " |") | |
| EOF |