Daily Summarization #3
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: Daily Summarization | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| slack_channel: | |
| description: Slack channel to post the error message to if the summarize job fail. | |
| required: false | |
| default: "sdv-alerts-debug" | |
| schedule: | |
| - cron: '0 1 * * *' | |
| jobs: | |
| summarize: | |
| environment: prod | |
| runs-on: ubuntu-latest-large | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| activate-environment: true | |
| cache-dependency-glob: | | |
| **/pyproject.toml | |
| **/__main__.py | |
| - name: Install pip and dependencies | |
| run: uv pip install . | |
| - name: Run Summarize | |
| run: | | |
| uv run pymetrics summarize \ | |
| --output-folder ${{ secrets.PYPI_OUTPUT_FOLDER }} | |
| env: | |
| PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }} | |
| PYPI_OUTPUT_FOLDER: ${{ secrets.PYPI_OUTPUT_FOLDER }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: sdv-dev/sdv-dev.github.io | |
| path: sdv-dev.github.io | |
| ref: 'gatsby-home' | |
| token: ${{ secrets.GH_TOKEN }} | |
| - name: Write to sdv-dev.github.io repo | |
| run: | | |
| find ./ -name '*.xlsx' -exec cp -prv '{}' 'sdv-dev.github.io/assets/' ';' | |
| cd sdv-dev.github.io | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add --force assets/*.xlsx | |
| git commit -m "Upload Download Summary - $(date '+%Y-%m-%d %H:%M:%S')" | |
| git remote set-url origin https://sdv-team:${{ secrets.GH_TOKEN }}@github.com/sdv-dev/sdv-dev.github.io | |
| git push origin gatsby-home | |
| alert: | |
| needs: [summarize] | |
| runs-on: ubuntu-latest | |
| if: failure() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| activate-environment: true | |
| - name: Install pip and dependencies | |
| run: | | |
| uv pip install .[dev] | |
| - name: Slack alert if failure | |
| run: | | |
| uv run python -m pymetrics.slack_utils \ | |
| -r ${{ github.run_id }} \ | |
| -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }} \ | |
| -m 'Daily Summarize PyMetrics failed :fire: :dumpster-fire: :fire:' | |
| env: | |
| SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |