Skip to content

Commit

Permalink
Update GHA workflow for chart sync
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo committed Oct 23, 2024
1 parent 6f0fc21 commit e23398b
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/scrape.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,25 @@ jobs:
issues: write

steps:
- name: Check event payload
shell: pwsh
run: |
$eventPayload = '${{ toJson(github) }}'
- name: Check to proceed
id: check_to_proceed
shell: pwsh
run: |
$proceed = "false"
$chartSyncRequest = "false"
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
$proceed = "true"
} elseif ("${{ github.event_name }}" -eq "schedule") {
$proceed = "true"
} elseif ("${{ github.event_name }}" -eq "issues" -and "${{ github.event.action }}" -eq "opened") {
if (${{ toJson(github.event.issue.body) }} -eq "### Issue Type\n\nSync Request") {
$proceed = "true"
$chartSyncRequest = "true"
}
}
"proceed=$proceed" >> $env:GITHUB_OUTPUT
"chartSyncRequest=$chartSyncRequest" >> $env:GITHUB_OUTPUT
- name: Checkout code
if: steps.check_to_proceed.outputs.proceed == 'true'
Expand Down Expand Up @@ -156,3 +154,14 @@ jobs:
$tracks = $collection.missingTracks | ConvertTo-Json -Depth 100
gh issue create --title "Missing tracks in Spotify playlist" --body "The following tracks are missing in the Spotify playlist:`r`n```````jsonr`n$tracks`r`n```````r`n"
- name: Close sync request
if: |
steps.check_to_proceed.outputs.proceed == 'true' &&
steps.check_to_proceed.outputs.chartSyncRequest == 'true'
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$issueNumber = ${{ github.event.issue.number }}
gh issue close $issueNumber -r completed -c "The chart has been synced up-to-date."

0 comments on commit e23398b

Please sign in to comment.