name: Label Community PR

on:
  pull_request:
    types: [opened]

jobs:
  label_pr:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v3
        with:
          python-version: '3.x'

      - name: Install dependencies
        run: pip install requests

      - name: Run labeling script
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PR_AUTHOR: ${{ github.event.pull_request.user.login }}
          PR_NUMBER: ${{ github.event.pull_request.number }}
          REPO_NAME: ${{ github.event.repository.name }}
          COMMUNITY_LABEL: "Community want to contribute"
        run: python .github/scripts/label_community_user.py
