CoffePrice uses a GitHub Actions workflow to run its full ML pipeline automatically every weekday. The workflow fetches live KC futures and TRM data, retrains the model, generates the next-day FNC price prediction, and commits the updated output files back to the repository. Because Railway (backend) and Netlify (frontend) are configured to auto-deploy on push, a single commit is all it takes to deliver a fresh prediction to the live site.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JaiderT/CoffeePrice/llms.txt
Use this file to discover all available pages before exploring further.
GitHub Actions Workflow
File:.github/workflows/actualizar-predicciones.yml
Schedule
The cron expression15 20 * * 1-5 triggers the workflow Monday through Friday at 20:15 UTC, which is 3:15 pm Colombia time (UTC−5). This timing was chosen to run after the NY Coffee C (KC=F) futures session has settled for the day, ensuring the latest closing price is available.
What the Workflow Does — Step by Step
Checkout the repository
Uses
actions/checkout@v4 with fetch-depth: 0 (full history) so that the commit step can push back without shallow-clone issues.Install ML dependencies
Installs all packages from
ml-service-experimental/requirements_hibrido.txt, including prophet==1.1.5, xgboost==2.0.3, pandas==2.0.3, and supporting libraries.Run the full pipeline
Executes
python actualizar_todo.py from the ml-service-experimental/ directory. This single command orchestrates all 11 pipeline steps: fetching KC, TRM, and FNC data; cleaning; building external variables; training Prophet and XGBoost; generating the prediction; and running evaluation.Commit updated artefacts
Stages three paths:
backend/datos/— includespredicciones_fnc.jsonandhistorial_predicciones_fnc.csvml-service-experimental/datos/— includes prediction history and evaluation CSVml-service-experimental/modelos/metricas_fnc_hibrido.json— latest model metrics
exit 0 and no commit is made.Manual Trigger
Theworkflow_dispatch trigger allows running the workflow on demand from the GitHub UI without waiting for the scheduled time:
- Go to the Actions tab in the GitHub repository.
- Select “Actualizar predicciones FNC” from the left sidebar.
- Click “Run workflow”, choose the branch, and click the green “Run workflow” button.
Prerequisites for Automation
GitHub Actions Enabled
GitHub Actions must be enabled for the repository. Check Settings → Actions → General and ensure actions are allowed.
Railway Auto-Deploy
The Railway backend project must be linked to the repository branch with auto-deploy enabled so it picks up the committed
predicciones_fnc.json.Netlify Auto-Deploy
The Netlify frontend site must be configured to rebuild on push to the same branch so the UI reflects the updated prediction.
No Secrets Required
The pipeline reads and writes files only — no external API keys are stored in GitHub Secrets. The
contents: write permission is sufficient for the commit-and-push step.Windows Local Alternative
For manual runs on Windows,actualizar_predicciones.ps1 provides a PowerShell wrapper that navigates to the correct directory and invokes the pipeline:
ml-service-experimental/, runs python actualizar_todo.py (forwarding the optional --fecha-prediccion argument), then confirms the output was written to backend/datos/predicciones_fnc.json.
Production vs. Development
| Context | Recommended approach |
|---|---|
| Production | Let GitHub Actions run on its cron schedule. Push code changes; the next scheduled run picks them up automatically. |
| Development / testing | Run python actualizar_todo.py manually inside ml-service-experimental/. Use --fecha-prediccion to backfill predictions for past dates. |
| Debugging a failed run | Check the Actions tab on GitHub for the full log. Re-run the failed job from the UI or trigger workflow_dispatch after fixing the issue. |
Monitoring
All workflow runs are visible in the Actions tab of the GitHub repository. Each run shows:- ✅ Green check: pipeline completed and prediction committed (or no changes to commit)
- ❌ Red X: a critical step failed — check the expanded step log for the Python traceback
The pipeline requires at least 45 historical FNC price records to train a usable model. If you are deploying CoffePrice to a brand-new environment, seed
datos/precios_fnc_historicos.csv with at least two months of historical FNC prices before enabling the scheduled workflow. Without sufficient history, the training step will exit with "No hay suficientes datos para entrenar un modelo usable." and the run will fail.