Refresh Courses #2
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 Courses | |
on: | |
schedule: | |
# At 00:00 on Monday. | |
- cron: "0 0 * * 1" | |
workflow_dispatch: | |
jobs: | |
refresh_courses: | |
runs-on: ubuntu-latest | |
steps: | |
# Clones the repo | |
- name: Checkout Repo Content | |
uses: actions/checkout@v2 | |
# Clones the data repo | |
- name: Clone Data Repo | |
uses: actions/checkout@v2 | |
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 course | |
# Commits the changes back to the data repo | |
- name: Push course_rows.txt to Data | |
uses: dmnemec/copy_file_to_another_repo_action@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source_file: './data/courses.psv' | |
destination_repo: 'itu-helper/data' | |
user_email: '[email protected]' | |
user_name: 'ITU Helper' |