name: pr-labels

on:
  push:
    branches:
      - main

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

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

      - name: Install requests
        run: pip install requests

      - 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/process_commit.py "${SHA1}"

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