Podcast data #934
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: Podcast data | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "5 11 * * 1,3,5" # Run at 04:05 on Monday, Wednesday, and Friday. | |
| jobs: | |
| data_workflow: | |
| name: Data workflow | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: app | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - uses: actions/setup-go@v6.4.0 | |
| with: | |
| go-version: "1.26" | |
| cache-dependency-path: app/go.sum | |
| # Caching go modules to speed up the run | |
| - uses: actions/cache@v5.0.5 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Build | |
| run: make build | |
| - name: GermanTechPodcasts Convert YAML to JSON | |
| run: ./GermanTechPodcasts convertYamlToJson --yaml-directory ../podcasts --json-directory ../generated | |
| - name: GermanTechPodcasts Gather additional podcast data | |
| run: ./GermanTechPodcasts collectPodcastData --api-key ${{ secrets.PODCASTINDEX_API_KEY }} --api-secret ${{ secrets.PODCASTINDEX_API_SECRET }} --json-directory ../generated | |
| - name: GermanTechPodcasts Convert JSON to README | |
| run: ./GermanTechPodcasts convertJsonToReadme --json-directory ../generated --readme-template ../assets/README.template --readme-output ../README.md | |
| - name: GermanTechPodcasts Render OPML file | |
| run: ./GermanTechPodcasts generateOpml --json-directory ../generated --opml-output ../podcasts.opml | |
| # Commit results back to repository | |
| - name: Commit changes | |
| id: auto-commit | |
| uses: stefanzweifel/git-auto-commit-action@v7.1.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| branch: main | |
| commit_message: "chore: Update generated podcast content" | |
| commit_user_name: "GitHub Actions Bot" | |
| commit_user_email: "actions@github.com" | |
| commit_author: "GitHub Actions Bot <actions@github.com>" | |
| skip_push: true | |
| - name: Push changes with retry | |
| if: steps.auto-commit.outputs.changes_detected == 'true' | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| max_retries=3 | |
| for attempt in $(seq 1 $max_retries); do | |
| echo "Push attempt $attempt of $max_retries" | |
| if git push origin main; then | |
| echo "Push succeeded on attempt $attempt" | |
| exit 0 | |
| fi | |
| echo "Push failed, pulling with rebase and retrying..." | |
| git pull --rebase origin main | |
| sleep $((attempt * 2)) | |
| done | |
| echo "Push failed after $max_retries attempts" | |
| exit 1 | |
| - name: Trigger webpage to sync | |
| uses: peter-evans/repository-dispatch@v4.0.1 | |
| with: | |
| token: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }} | |
| repository: EngineeringKiosk/webpage | |
| event-type: podcast-list-update |