---
name: "Metadata: Label pull requests"

on:
  pull_request_target:
    types:
      - opened
      - edited
      - closed
      - reopened
      - ready_for_review
      - synchronize

jobs:
  label-size:
    name: Label Size
    runs-on: ubuntu-latest
    steps:
      - name: Generate Token
        uses: tibdex/github-app-token@v1
        id: generate-token
        with:
          app_id: ${{ secrets.K8S_AT_HOME_APP_ID }}
          private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }}

      - name: Label Size
        uses: pascalgn/size-label-action@v0.4.3
        env:
          GITHUB_TOKEN: "${{ steps.generate-token.outputs.token }}"
        with:
          sizes: >
            {
              "0": "XS",
              "20": "S",
              "50": "M",
              "200": "L",
              "800": "XL",
              "2000": "XXL"
            }
