From 04a4876471848bb50d07dad4bc6ced5d559614c5 Mon Sep 17 00:00:00 2001 From: Fedor Dikarev Date: Tue, 3 Dec 2024 13:24:07 +0400 Subject: [PATCH] collect workflow stats (#124) As part of out Worfklows Observabiltiy, lets also collect here stats for Workflow Runs (including jobs, steps, attempts, etc) for getting insights on usage and possible CI improvements --- .../workflows/report-workflow-stats-batch.yml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/report-workflow-stats-batch.yml diff --git a/.github/workflows/report-workflow-stats-batch.yml b/.github/workflows/report-workflow-stats-batch.yml new file mode 100644 index 0000000..1da7c3d --- /dev/null +++ b/.github/workflows/report-workflow-stats-batch.yml @@ -0,0 +1,53 @@ +name: Report Workflow Stats Batch + +on: + schedule: + - cron: '*/15 * * * *' + - cron: '25 0 * * *' + - cron: '25 1 * * 6' + +jobs: + gh-workflow-stats-batch-2h: + name: GitHub Workflow Stats Batch 2 hours + if: github.event.schedule == '*/15 * * * *' + runs-on: ubuntu-22.04 + permissions: + actions: read + steps: + - name: Export Workflow Run for the past 2 hours + uses: neondatabase/gh-workflow-stats-action@v0.2.1 + with: + db_uri: ${{ secrets.GH_REPORT_STATS_DB_RW_CONNSTR }} + db_table: 'gh_workflow_stats_serverless' + gh_token: ${{ secrets.GITHUB_TOKEN }} + duration: '2h' + + gh-workflow-stats-batch-48h: + name: GitHub Workflow Stats Batch 48 hours + if: github.event.schedule == '25 0 * * *' + runs-on: ubuntu-22.04 + permissions: + actions: read + steps: + - name: Export Workflow Run for the past 48 hours + uses: neondatabase/gh-workflow-stats-action@v0.2.1 + with: + db_uri: ${{ secrets.GH_REPORT_STATS_DB_RW_CONNSTR }} + db_table: 'gh_workflow_stats_serverless' + gh_token: ${{ secrets.GITHUB_TOKEN }} + duration: '48h' + + gh-workflow-stats-batch-30d: + name: GitHub Workflow Stats Batch 30 days + if: github.event.schedule == '25 1 * * 6' + runs-on: ubuntu-22.04 + permissions: + actions: read + steps: + - name: Export Workflow Run for the past 30 days + uses: neondatabase/gh-workflow-stats-action@v0.2.1 + with: + db_uri: ${{ secrets.GH_REPORT_STATS_DB_RW_CONNSTR }} + db_table: 'gh_workflow_stats_serverless' + gh_token: ${{ secrets.GITHUB_TOKEN }} + duration: '720h'