Skip to content

Generate Predictions #364

Generate Predictions

Generate Predictions #364

Workflow file for this run

name: Generate Predictions
on:
workflow_run:
workflows: ["Clean Data"] # Name of the workflow to wait for
types:
- completed # Trigger only when the workflow completes
workflow_dispatch:
jobs:
run_python_notebooks:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout repository again in this job
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Cache pip dependencies
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('Website code/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# Step 3: Setup Python environment
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10.13' # Replace with your preferred version if needed
# Step 4: Install Python dependencies
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install Python dependencies
run: |
pip install --upgrade tensorflow
pip install -r "Website code/requirements.txt"
# Step 5: Run the model generation Python notebook
- name: Run Model Generation Notebook
run: |
python "Website code/model_generation.py"
# Step 6: Commit model generation outputs
- name: Commit and push model outputs
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add .
git commit --allow-empty -m "Update model outputs"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Step 7: Run the prediction generation Python notebook
- name: Run Prediction Generation Notebook
run: |
python "Website code/prediction_function.py"
# Step 8: Commit and push changes back to the repository
- name: Commit and push changes
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add .
git commit --allow-empty -m "Update predictions.json"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}