name: 'Generate registry area labels'
on:
  push:
    branches: [main]
    paths:
      - model/registry/**
      - ./.github/workflows/generate-registry-area-labels.yml
      - ./.github/workflows/scripts/generate-registry-area-labels.sh
  workflow_dispatch:

jobs:
  generate-component-labels:
    runs-on: ubuntu-latest
    if: ${{ github.repository_owner == 'open-telemetry' }}
    steps:
      - uses: actions/checkout@v4

      - name: Run update permissions
        run: chmod +x ./.github/workflows/scripts/generate-registry-area-labels.sh

      - name: Generate registry area labels
        run: ./.github/workflows/scripts/generate-registry-area-labels.sh
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
