---
name: Sync stable and dev version branches

on:
  pull_request_target:
    types:
      - closed
    branches:
      - "[2-9][0-9].[0-9][0-9].x"
  workflow_dispatch:

jobs:
  main:
    name: Sync Stable Branches
    runs-on: ubuntu-24.04
    if: github.event.pull_request.merged == true
    steps:
      - name: git checkout
        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
        with:
          fetch-depth: 0
          token: ${{ secrets.CENTREON_TECHNIQUE_PAT }}

      - name: Sync Branches
        id: release
        uses: ./.github/actions/sync-branches
        with:
          src_branch: ${{ github.ref_name }}
          dest_branch: dev-${{ github.ref_name }}
