From 51fc644fefdeca6d87ec8bbdfafd610ea9d25a4e Mon Sep 17 00:00:00 2001 From: Justin Yoo Date: Tue, 22 Oct 2024 12:48:19 +1100 Subject: [PATCH] Update GHA workflow for daily scraping --- .github/workflows/scrape.yaml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scrape.yaml b/.github/workflows/scrape.yaml index a915561..0c02fc8 100644 --- a/.github/workflows/scrape.yaml +++ b/.github/workflows/scrape.yaml @@ -68,7 +68,7 @@ jobs: $result | Out-File -FilePath "daily100-$date.json" -Force popd - - name: Run Spotify app - Daily 100 + - name: Run Spotify app - Melon Top 100 shell: pwsh run: | $appsettings = Get-Content -Path ./samples/SpotifyPlaylist.ConsoleApp/appsettings.Development.sample.json | ConvertFrom-Json @@ -77,8 +77,8 @@ jobs: $appsettings | ConvertTo-Json -Depth 100 | Out-File -FilePath ./samples/SpotifyPlaylist.ConsoleApp/appsettings.Development.json -Force $date = (Get-Date).ToUniversalTime().AddHours(9).ToString("yyyyMMdd") - # $result = dotnet run --project ./samples/SpotifyPlaylist.ConsoleApp/ -- -t spotify -s ${{ secrets.SPOTIFY_PLAYLIST_ID }} --json | ConvertFrom-Json - $result = dotnet run --project ./samples/SpotifyPlaylist.ConsoleApp/ -- -t spotify -s ${{ secrets.SPOTIFY_PLAYLIST_ID }} --json + # $result = dotnet run --project ./samples/SpotifyPlaylist.ConsoleApp/ -- -t spotify -s ${{ secrets.SPOTIFY_MELON_TOP100_PLAYLIST_ID }} --json | ConvertFrom-Json + $result = dotnet run --project ./samples/SpotifyPlaylist.ConsoleApp/ -- -t spotify -s ${{ secrets.SPOTIFY_MELON_TOP100_PLAYLIST_ID }} --json mkdir -p ./data pushd ./data @@ -86,6 +86,24 @@ jobs: $result[$($result.indexOf("{"))..$($result.Length-1)] | Out-File -FilePath "spotify100-$date.json" -Force popd + - name: Run Spotify app - Billboard Hot 100 + shell: pwsh + run: | + $appsettings = Get-Content -Path ./samples/SpotifyPlaylist.ConsoleApp/appsettings.Development.sample.json | ConvertFrom-Json + $appsettings.Azure.APIM.BaseUrl = "${{ secrets.APIM_BASE_URL }}" + $appsettings.Azure.APIM.SubscriptionKey = "${{ secrets.APIM_SUBSCRIPTION_KEY }}" + $appsettings | ConvertTo-Json -Depth 100 | Out-File -FilePath ./samples/SpotifyPlaylist.ConsoleApp/appsettings.Development.json -Force + + $date = (Get-Date).ToUniversalTime().AddHours(9).ToString("yyyyMMdd") + # $result = dotnet run --project ./samples/SpotifyPlaylist.ConsoleApp/ -- -t spotify -s ${{ secrets.SPOTIFY_BILLBOARD_HOT100_PLAYLIST_ID }} --json | ConvertFrom-Json + $result = dotnet run --project ./samples/SpotifyPlaylist.ConsoleApp/ -- -t spotify -s ${{ secrets.SPOTIFY_BILLBOARD_HOT100_PLAYLIST_ID }} --json + + mkdir -p ./data + pushd ./data + # $result[$($result.indexOf("{"))..$($result.Length-1)] | ConvertTo-Json -Depth 100 | Out-File -FilePath "billboard100-$date.json" -Force + $result[$($result.indexOf("{"))..$($result.Length-1)] | Out-File -FilePath "billboard100-$date.json" -Force + popd + - name: Upload data uses: stefanzweifel/git-auto-commit-action@v5 with: