Scrape latest data #17739
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: Scrape latest data | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 */2 * * *' | |
| jobs: | |
| scheduled: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install newsapi-python | |
| - name: Run script | |
| env: | |
| FIRSTAPI: ${{ secrets.FIRSTAPI }} | |
| SECONDAPI: ${{ secrets.SECONDAPI }} | |
| THIRDAPI: ${{ secrets.THIRDAPI }} | |
| FOURTHAPI: ${{ secrets.FOURTHAPI }} | |
| FIFTHAPI: ${{ secrets.FIFTHAPI }} | |
| SIXTHAPI: ${{ secrets.SIXTHAPI }} | |
| SEVENTHAPI: ${{ secrets.SEVENTHAPI }} | |
| run: | | |
| python main.py | |
| - name: Commit and push if it changed | |
| run: |- | |
| git config user.name "Automated" | |
| git config user.email "[email protected]" | |
| git add -A | |
| timestamp=$(date -u) | |
| git commit --allow-empty -m "Latest data: ${timestamp}" || exit 0 | |
| git push |