name: pr-labels

on:
  push:
    branches:
      - master

jobs:
  is-properly-labeled:
    runs-on: ubuntu-latest

    steps:
      - name: Set up python
        uses: actions/setup-python@v2

      - name: Install requests
        run: pip3 install requests==2.26

      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Process commit and find merger responsible for labeling
        id: commit
        env:
          SHA1: ${{ github.sha }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: python .github/scripts/process_commit.py "${SHA1}"

concurrency:
  group: pr-labels-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
  cancel-in-progress: true
