Run Daily Scrapper #316
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: Run Daily Scrapper | |
on: | |
schedule: | |
- cron: "31 13 * * *" | |
workflow_dispatch: | |
jobs: | |
run_app: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.WB_UPDATE }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.6 | |
- name: Setup Poetry | |
run: pip install poetry | |
- name: Run Poetry install deps | |
run: | | |
poetry --version | |
cd $GITHUB_WORKSPACE | |
poetry install --no-root | |
- name: Run Python app | |
env: | |
TG_API_HASH: ${{ secrets.TG_API_HASH }} | |
TG_API_ID: ${{ secrets.TG_API_ID }} | |
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} | |
TG_CHANNEL_ID: ${{ secrets.TG_CHANNEL_ID }} | |
run: | | |
poetry run python main.py | |
- name: Add log files to repo | |
run: | | |
echo "Adding logs to Git..." | |
git add logs | |
- name: Check for changes | |
id: check_changes | |
run: | | |
git diff-index --quiet HEAD || echo "changes=true" >> $GITHUB_OUTPUT | |
- name: Commit changes | |
if: steps.check_changes.outputs.changes == 'true' | |
run: | | |
echo "Checking changes to Git..." | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
echo "Changes registered commit & push" | |
git commit -m "Log update `date +'%d-%m-%Y %H:%M:%S'`" | |
git push |