name: Trigger BCR Frontend Rebuild
on:
  push:
    branches:
      - main
      
jobs:
  trigger_build:
    runs-on: ubuntu-latest
    steps:
      - name: Trigger BCR Frontend Rebuild
        uses: peter-evans/repository-dispatch@v4
        with:
          repository: bazel-contrib/bcr-frontend
          # Fine-grained PAT (https://github.com/settings/personal-access-tokens/new), which needs
          # to be exchanged once a year.
          # Scoped to the `bazel-contrib/bcr-frontend` repository.
          # Requires "Read and write" permissions for "Contents" and "Workflows" to be able to do the workflow dispatch.
          token: ${{ secrets.BCR_FRONTEND_REPO_ACCESS_TOKEN }}
          event-type: on-bcr-trigger
          client-payload: '{"bcrCommitHash": "${{ github.sha }}"}'
