Update news #259
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: Update news | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Once every 24 hours at 00:00 UTC | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: update-news-main | |
| cancel-in-progress: false | |
| jobs: | |
| fetch-rss: | |
| name: Fetch RSS | |
| runs-on: ubuntu-latest | |
| permissions: &write-permissions | |
| contents: write | |
| env: | |
| OUTPUT_PATH: code/rss_output/ | |
| COMMIT_MESSAGE: Update RSS feeds | |
| steps: | |
| - &checkout | |
| name: Checkout main | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - &setup-pnpm | |
| name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: latest | |
| - &setup-node | |
| name: Setup Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: '22' | |
| cache: pnpm | |
| cache-dependency-path: code/pnpm-lock.yaml | |
| - &install | |
| name: Install dependencies | |
| run: pnpm install | |
| working-directory: ./code | |
| - name: Fetch RSS feeds | |
| run: pnpm run feeds | |
| working-directory: ./code | |
| - name: Validate RSS output | |
| run: pnpm run validate-feeds | |
| working-directory: ./code | |
| - &commit | |
| name: Commit | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git add -- "$OUTPUT_PATH" | |
| if ! git diff --staged --quiet; then | |
| git commit -m "$COMMIT_MESSAGE $(date -u +'%Y-%m-%d %H:%M UTC')" | |
| git pull --rebase origin main | |
| git push origin HEAD:main | |
| else | |
| echo "No changes to commit" | |
| fi | |
| cluster-tech: | |
| name: Cluster tech | |
| needs: fetch-rss | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| permissions: *write-permissions | |
| env: | |
| CATEGORY: tech | |
| LANGUAGE: es | |
| OUTPUT_PATH: code/rss_output_cluster/rss_tech_clusters_es.json | |
| COMMIT_MESSAGE: Update tech clusters | |
| steps: | |
| - *checkout | |
| - *setup-pnpm | |
| - *setup-node | |
| - *install | |
| - &cluster | |
| name: Generate clusters | |
| run: pnpm run cluster -- "$CATEGORY" | |
| working-directory: ./code | |
| env: | |
| OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} | |
| - &validate-cluster | |
| name: Validate clusters | |
| run: pnpm run validate-clusters -- "$CATEGORY" "$LANGUAGE" | |
| working-directory: ./code | |
| - *commit | |
| cluster-finance: | |
| name: Cluster finance | |
| needs: cluster-tech | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| permissions: *write-permissions | |
| env: | |
| CATEGORY: finance | |
| LANGUAGE: es | |
| OUTPUT_PATH: code/rss_output_cluster/rss_finance_clusters_es.json | |
| COMMIT_MESSAGE: Update finance clusters | |
| steps: | |
| - *checkout | |
| - *setup-pnpm | |
| - *setup-node | |
| - *install | |
| - *cluster | |
| - *validate-cluster | |
| - *commit | |
| cluster-gaming: | |
| name: Cluster gaming | |
| needs: cluster-finance | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| permissions: *write-permissions | |
| env: | |
| CATEGORY: gaming | |
| LANGUAGE: es | |
| OUTPUT_PATH: code/rss_output_cluster/rss_gaming_clusters_es.json | |
| COMMIT_MESSAGE: Update gaming clusters | |
| steps: | |
| - *checkout | |
| - *setup-pnpm | |
| - *setup-node | |
| - *install | |
| - *cluster | |
| - *validate-cluster | |
| - *commit | |
| cluster-japan: | |
| name: Cluster japan | |
| needs: cluster-gaming | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| permissions: *write-permissions | |
| env: | |
| CATEGORY: japan | |
| LANGUAGE: es | |
| OUTPUT_PATH: code/rss_output_cluster/rss_japan_clusters_es.json | |
| COMMIT_MESSAGE: Update japan clusters | |
| steps: | |
| - *checkout | |
| - *setup-pnpm | |
| - *setup-node | |
| - *install | |
| - *cluster | |
| - *validate-cluster | |
| - *commit | |
| translate: | |
| name: Translate clusters | |
| needs: cluster-japan | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| permissions: *write-permissions | |
| env: | |
| OUTPUT_PATH: code/rss_output_cluster/ | |
| COMMIT_MESSAGE: Update cluster translations | |
| steps: | |
| - *checkout | |
| - *setup-pnpm | |
| - *setup-node | |
| - *install | |
| - name: Translate all categories | |
| id: translate | |
| continue-on-error: true | |
| run: pnpm run translate | |
| working-directory: ./code | |
| env: | |
| OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} | |
| - *commit | |
| - name: Validate all translations | |
| id: validate | |
| if: ${{ !cancelled() }} | |
| continue-on-error: true | |
| run: pnpm run validate-clusters | |
| working-directory: ./code | |
| - name: Report translation failures | |
| if: ${{ !cancelled() && (steps.translate.outcome == 'failure' || steps.validate.outcome == 'failure') }} | |
| run: | | |
| echo "Translation or validation failed; successful files were committed" | |
| exit 1 |