Generate Feeds #58
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: Generate Feeds | |
| on: | |
| schedule: | |
| - cron: '17 22 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| mode: | |
| description: What to fetch | |
| required: false | |
| default: all | |
| type: choice | |
| options: | |
| - all | |
| - tweets-only | |
| - blogs-only | |
| - podcasts-only | |
| ignore_state: | |
| description: Preview without updating state | |
| required: false | |
| default: false | |
| type: boolean | |
| concurrency: | |
| group: ai-trend-push-generate-feed | |
| cancel-in-progress: false | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Sync latest main | |
| run: git pull --ff-only origin main | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate feeds | |
| env: | |
| FOLO_TOKEN: ${{ secrets.FOLO_TOKEN }} | |
| FOLO_LIST_ID: ${{ vars.FOLO_LIST_ID }} | |
| AITRENDPUSH_PRIVATE_RSS_FEEDS: ${{ secrets.AITRENDPUSH_PRIVATE_RSS_FEEDS }} | |
| AITRENDPUSH_IGNORE_STATE: ${{ inputs.ignore_state && '1' || '0' }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.mode }}" != "all" ]; then | |
| npm run generate -- --${{ inputs.mode }} | |
| else | |
| npm run generate | |
| fi | |
| - name: Commit and push feeds | |
| if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.ignore_state) }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add archives feed-index.json state-feed.json | |
| if git diff --cached --quiet; then | |
| echo "No feed changes to commit." | |
| exit 0 | |
| fi | |
| git commit -m "chore: update feeds [skip ci]" | |
| git pull --rebase origin main | |
| git push origin HEAD:main |