Refresh Lessons #71862
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: Refresh Lessons | |
on: | |
schedule: | |
# At every 5th minute from 4 through 59 past every hour from 2 through 23. | |
- cron: "4/5 2/1 * * *" | |
workflow_dispatch: | |
jobs: | |
refresh_lessons: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
# Clones the repo | |
- name: Checkout Repo Content | |
uses: actions/checkout@v4 | |
# Clones the data repo | |
- name: Clone Data Repo | |
uses: actions/checkout@v4 | |
with: | |
repository: itu-helper/data | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
path: ./data/ | |
# Go Back to the main repo | |
- name: Back to Main Repo | |
run: | | |
cd .. | |
# Sets up python | |
- name: Python Setup | |
uses: actions/[email protected] | |
with: | |
python-version: 3.11 | |
# Install the python requirements via pip | |
- name: Install Python Requirements | |
run: pip install -r requirements.txt | |
# Run the python script | |
- name: Python Run | |
run: | | |
python src/run.py -scrap_target lesson | |
# Commits the changes back to the data repo | |
- name: Push lessons.psv to itu-helper/data | |
uses: dmnemec/copy_file_to_another_repo_action@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source_file: './data/lessons.psv' | |
destination_repo: 'itu-helper/data' | |
user_email: '[email protected]' | |
user_name: 'ITU Helper' |