Automated Python Script #129
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: Automated Python Script | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' # Runs every Sunday at midnight | |
| workflow_dispatch: | |
| jobs: | |
| run-scripts: | |
| runs-on: ubuntu-latest | |
| env: | |
| COPERNICUS_USERNAME: ${{ secrets.COPERNICUS_USERNAME }} | |
| COPERNICUS_PASSWORD: ${{ secrets.COPERNICUS_PASSWORD }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| strategy: | |
| matrix: | |
| script: [ | |
| "Globcolor.py", | |
| "Model.py", | |
| "Globcolor_points.py", | |
| "model_points.py", | |
| "sst.py", | |
| "sst_poly.py", | |
| "sentinel_point.py", | |
| "sentinel_offshore.py", | |
| "sentinel_nearshore.py" | |
| ] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python environment | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pandas==2.2.3 requests numpy copernicusmarine boto3==1.34.49 geopandas rioxarray | |
| - name: Execute Python script | |
| run: python ${{ matrix.script }} | |
| commit-and-push: | |
| runs-on: ubuntu-latest | |
| needs: run-scripts | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Commit and push if there are changes | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add -A | |
| git commit -m "Automated data update" || echo "No changes to commit" | |
| git push |