Data Drift Monitoring and Model Retraining Workflow #28
This file contains hidden or 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: Data Drift Monitoring and Model Retraining Workflow | |
| on: | |
| schedule: | |
| - cron: '0 0 21 * *' | |
| workflow_dispatch: | |
| jobs: | |
| Data_Drift_Monitoring_and_Model_Retraining: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.11 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Set DSN secret | |
| run: echo "DSN=${{ secrets.DSN }}" >> $GITHUB_ENV | |
| - name: Run retraining script | |
| run: | | |
| python py_scripts/data_drift_monitoring.py | |
| - name: Configure Git | |
| run: | | |
| git config --local user.email "actions@github.com" | |
| git config --local user.name "GitHub Actions" | |
| - name: Check for Unstaged Changes and Commit | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "There are unstaged changes. Committing ..." | |
| git add --all | |
| git commit -m "Monthly Data Drift Monitoring and Model Retraining" | |
| else | |
| echo "No unstaged changes." | |
| fi | |
| - name: Pull and Rebase | |
| run: | | |
| git pull origin main --rebase || echo "No changes to rebase" | |
| - name: Push Changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.PAT }} |