name: Sync PR

on:
  push:
    branches:
      - '8.*.x'
  schedule:
    - cron: '33 04 * * 1-5' # 04:33 UTC Mon-Fri
  workflow_dispatch:
    inputs:
      head_branch:
        description: Branch to merge into master
        required: true

jobs:
  sync:
    if: github.repository_owner == 'cylc' || github.event_name != 'schedule'
    uses: cylc/release-actions/.github/workflows/branch-sync.yml@v1
    with:
      head_branch: ${{ inputs.head_branch }}
    secrets: inherit
