Revert "fix(tofu): rm gh token env" #12
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: "Torin Asakura" | |
| TRACKS: | | |
| One More Night | |
| Robocop Origin | |
| Малинки | |
| 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 | |
| - name: Spotify | |
| env: | |
| SPOTIFY_TOKEN: ${{ secrets.SPOTIFY_TOKEN }} | |
| run: | | |
| echo "TODO: get spotify token" | |
| # python scripts/music-release-tracker/spotify/main.py | |
| - name: Apple Music | |
| run: | | |
| python scripts/music-release-tracker/apple-music/main.py | |
| - name: YouTube Music | |
| env: | |
| YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
| run: | | |
| echo "TODO: get release_date for songs" | |
| # python scripts/music-release-tracker/youtube-music/main.py | |
| - 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) | |
| if not data: | |
| print("## Music availability\n") | |
| print("_dict.yaml is empty_") | |
| raise SystemExit(0) | |
| platforms = set() | |
| for v in data.values(): | |
| if isinstance(v, dict): | |
| platforms.update(v.keys()) | |
| platforms = sorted(platforms) | |
| def fmt_cell(entry): | |
| if not isinstance(entry, dict): | |
| return "⚠️ unknown" | |
| status = entry.get("status", "unknown") | |
| release_date = entry.get("release_date") | |
| if status == 1: | |
| icon = "✅" | |
| elif status == 0: | |
| icon = "❌" | |
| else: | |
| icon = "⚠️" | |
| if release_date: | |
| return f"{icon} {release_date}" | |
| if status == "unknown": | |
| return f"{icon} unknown" | |
| return icon | |
| print("## Music availability\n") | |
| header = "| Track | " + " | ".join(platforms) + " |" | |
| sep = "| --- | " + " | ".join(["---"] * len(platforms)) + " |" | |
| print(header) | |
| print(sep) | |
| for track in sorted(data.keys()): | |
| track_entry = data.get(track) or {} | |
| row = [track] | |
| for p in platforms: | |
| cell = fmt_cell(track_entry.get(p)) | |
| row.append(cell) | |
| print("| " + " | ".join(row) + " |") | |
| EOF |