Fetch latest speeches from president.gov.ua and push them to the HuggingFace #244
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: Fetch latest speeches from president.gov.ua and push them to the HuggingFace | |
on: | |
schedule: | |
- cron: '20 23 * * *' | |
workflow_dispatch: | |
env: | |
HF_HOME: "./.huggignface" | |
jobs: | |
run-python-script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Cache Language detection model | |
id: cache-language-detection-model | |
uses: actions/cache@v4 | |
with: | |
path: ${{env.HF_HOME}}/hub/models--papluca--xlm-roberta-base-language-detection | |
key: ${{ runner.os }}-huggingface | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10.12' | |
cache: 'poetry' | |
- name: Fetch and update speeches | |
run: | | |
poetry install --no-root | |
source $(poetry env info --path)/bin/activate | |
huggingface-cli login --token ${{ secrets.HF_TOKEN }} | |
python ./src/z_scrap/main.py | |
- name: Commit and push latest speech timestamp | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add last_speech_timestamp_*.txt | |
git commit -m "Auto-update of last_speech_timestamp_*.txt" || exit 0 | |
git push |