Data Drift Monitoring and Model Retraining Workflow #12
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 28-31 * *' | |
| 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 | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "There are unstaged changes. Committing ..." | |
| git add --all | |
| git commit -m "Automated commit to avoid unstaged changes before pull" | |
| else | |
| echo "No unstaged changes." | |
| fi | |
| - name: Pull and Rebase | |
| run: | | |
| git pull origin main --rebase || echo "No changes to rebase" | |
| - name: Commit Changes | |
| run: | | |
| git diff --exit-code || (git add --all && git commit -m "Monthly Data Drift Monitoring and Model Retraining") | |
| - name: Push Changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.PAT }} | |