Python News Scraping Scheduled Script #6026
This file contains 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: Python News Scraping Scheduled Script | |
on: | |
schedule: | |
- cron: "0 6-18 * * 1-5" | |
- cron: "0 */12 * * 0,6" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Timezone | |
uses: szenius/set-timezone@v2.0 | |
with: | |
timezoneLinux: "Europe/Rome" | |
- name: Checkout Repository | |
uses: actions/checkout@v4.1.4 | |
- name: Setup Python Version | |
uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: "3.10" | |
- name: Install Python Dependencies | |
uses: py-actions/py-dependency-install@v4.1.0 | |
with: | |
path: "requirements.txt" | |
- name: Execute Python Script | |
env: | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
CHAT_ID_NEWS_IT: ${{ secrets.CHAT_ID_NEWS_IT }} | |
CHAT_ID_NEWS_EN: ${{ secrets.CHAT_ID_NEWS_EN }} | |
run: python main.py | |
- name: Commit Files | |
run: | | |
git config --local user.name liggiorgio | |
git config --local user.email "liggiorgio@live.com" | |
git add --all | |
git diff-index --quiet HEAD || git commit -am "GH ACTION News Scraping $(date)" | |
git push origin master | |
env: | |
REPO_KEY: ${{secrets.GITHUB_TOKEN}} | |
username: github-actions |