Biweekly Traffic collection #35
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: Biweekly Traffic collection | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| slack_channel: | |
| description: Slack channel to post the error message to if the builds fail. | |
| required: false | |
| default: "sdv-alerts-debug" | |
| schedule: | |
| - cron: "0 0 */14 * *" # Runs every 14 days at midnight UTC | |
| jobs: | |
| daily_traffic_collection: | |
| environment: traffic | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| activate-environment: true | |
| - name: Install dependencies | |
| run: | | |
| uv pip install . | |
| - name: Collect GitHub Traffic Data | |
| run: | | |
| uv run gitmetrics traffic \ | |
| --config-file traffic_config.yaml \ | |
| --token ${{ secrets.GH_TOKEN }} \ | |
| --output-folder ${{ secrets.OUTPUT_FOLDER }} | |
| env: | |
| PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }} | |
| alert: | |
| needs: [daily_traffic_collection] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| 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 dependencies | |
| run: | | |
| uv pip install .[dev] | |
| - name: Slack alert if failure | |
| run: python -m gitmetrics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }} | |
| env: | |
| SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |