Update TQQQ Feed #6555
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 TQQQ Feed | |
| concurrency: | |
| group: tqqq-feed-update | |
| cancel-in-progress: true | |
| on: | |
| schedule: | |
| # Run every 5 minutes, Monday through Friday only | |
| - cron: '*/5 * * * 1-5' | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| update-feed: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Fetch TQQQ data and generate feed | |
| run: python fetch_tqqq_feed.py | |
| - name: Show emitted item count (from generated file) | |
| run: | | |
| echo "== Emitted items in docs/feed.rss ==" | |
| grep -c "<item>" docs/feed.rss || true | |
| - name: Commit and push if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Avoid non-fast-forward failures when another run pushed between checkout and commit. | |
| git fetch origin | |
| git pull --rebase origin "${GITHUB_REF_NAME}" || true | |
| git add docs/ | |
| # Check if there are changes to commit | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update TQQQ feed - $(date -u +'%Y-%m-%d %H:%M:%S UTC')" | |
| # Retry once on non-fast-forward. | |
| git push || (git pull --rebase origin "${GITHUB_REF_NAME}" && git push) | |
| fi | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'docs/' | |
| deploy: | |
| needs: update-feed | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |