fleet/.github/workflows/collect-eng-metrics-test.yml
Victor Lyuboslavsky 0d095b3778
Add workflows to collect engineering metrics. (#30540)
Fixes #29140 

This is an engineering initiated story that does not impact product.
This code has been running and manually tested in my own repo:
https://github.com/getvictor/eng-metrics

See
[README.md](https://github.com/fleetdm/fleet/blob/victor/29140-eng-metrics/.github/actions/eng-metrics/README.md)
in this branch for details.

The metrics can be viewed on
https://fleeteng.grafana.net/d/b97a629f-3626-4a28-9781-0fa3c8427897/engineering-metrics
(credentials in 1Password)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Introduced an engineering metrics collection tool that gathers GitHub
metrics (e.g., Time to First Review, Time to Merge) and uploads them to
BigQuery.
* Added support for user group management and product group mapping via
markdown parsing.
* Enabled print-only mode for testing metrics output without uploading
to BigQuery.
* Added automatic handling of bot filtering, weekend-aware time
calculations, and differential syncing of user groups.
* Implemented robust GitHub username validation and retry logic for API
rate limits.

* **Documentation**
* Added comprehensive usage and configuration documentation for the
engineering metrics tool.

* **Chores**
* Added configuration, environment example, and workflow files for
automated metrics collection and testing.
* Specified Node.js version and set up project dependencies and scripts.

* **Tests**
* Added extensive unit and end-to-end test suites to ensure reliability
of metrics collection, configuration, and integrations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 16:59:25 -05:00

57 lines
1.4 KiB
YAML

name: Collect engineering metrics test
on:
push:
branches:
- main
- patch-*
- prepare-*
paths:
- '.github/actions/eng-metrics/**'
pull_request:
paths:
- '.github/actions/eng-metrics/**'
workflow_dispatch:
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id}}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Test Engineering Metrics Action
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- name: Setup Node.js 20
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '.github/actions/eng-metrics/package-lock.json'
- name: Install dependencies
run: npm ci
working-directory: .github/actions/eng-metrics
- name: Run linting
run: npm run lint
working-directory: .github/actions/eng-metrics
- name: Run tests
run: npm test
working-directory: .github/actions/eng-metrics
env:
NODE_ENV: test