name: Reusable - Muzzle

on:
  workflow_call:
    inputs:
      cache-read-only:
        type: boolean
        required: false

permissions:
  contents: read

jobs:
  muzzle:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        task:
          - ":instrumentation:muzzle1"
          - ":instrumentation:muzzle2"
          - ":instrumentation:muzzle3"
          - ":instrumentation:muzzle4"
      fail-fast: false
    steps:
      - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

      - name: Free disk space
        run: .github/scripts/gha-free-disk-space.sh

      - name: Set up JDK for running Gradle
        uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
        with:
          distribution: temurin
          java-version: 17.0.6

      - name: Run muzzle
        uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e # v3.1.0
        with:
          arguments: ${{ matrix.task }}
          cache-read-only: ${{ inputs.cache-read-only }}
