---
name: Measure Test Flakiness

on:
  schedule:
    - cron: "0 0 * * 0" # run every Sunday at midnight

permissions: read-all

jobs:
  measure-test-flakiness:
    name: Measure Test Flakiness
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
      - env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          set -euo pipefail

          ./scripts/measure-test-flakiness.sh
          make bin/etcd-test-analyzer
          bin/etcd-test-analyzer run -token $GITHUB_TOKEN -max-age=168h -workflow Tests -branch main
