name: Update xrblocks.github.io

on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - "docs/**"
      - "README.md"
      - "src/**"
      - "demos/**"
      - "templates/**"
      - "samples/**"

jobs:
  dispatch-to-xrblocks-github-io:
    if: github.repository == 'google/xrblocks'
    runs-on: ubuntu-latest
    steps:
      - name: Trigger build in xrblocks.github.io
        uses: peter-evans/repository-dispatch@v4
        with:
          token: ${{ secrets.XRBLOCKS_GITHUB_IO_PAT }}
          repository: xrblocks/xrblocks.github.io
          event-type: xrblocks_update
          client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
