Skip to content
Latchkey

PR Size Labeler workflow (krkn-chaos/krkn)

The PR Size Labeler workflow from krkn-chaos/krkn, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: krkn-chaos/krkn.github/workflows/pr-size-labeler.ymlLicense Apache-2.0View source

What it does

This is the PR Size Labeler workflow from the krkn-chaos/krkn repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: PR Size Labeler

on:
  pull_request_target:
    types: [opened, synchronize, reopened, edited]

permissions:
  pull-requests: write
  issues: write
  contents: read

jobs:
  size-label:
    runs-on: ubuntu-latest
    steps:
      - name: Label PR by size
        uses: codelytv/pr-size-labeler@095a41fca88b8764fd9e008ad269bcdb82bb38b9 # v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          xs_label: "size/xs"
          xs_max_size: "10"
          s_label: "size/s"
          s_max_size: "100"
          m_label: "size/m"
          m_max_size: "500"
          l_label: "size/l"
          l_max_size: "1000"
          xl_label: "size/xl"
          fail_if_xl: "false"
          message_if_xl: >
            This PR exceeds the recommended size of 1000 lines.
            Please consider splitting it into smaller, focused PRs to make
            it easier to review and reduce the risk of regressions.
          files_to_ignore: "requirements.txt *.lock"

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: PR Size Labeler
 
on:
  pull_request_target:
    types: [opened, synchronize, reopened, edited]
 
permissions:
  pull-requests: write
  issues: write
  contents: read
 
jobs:
  size-label:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Label PR by size
        uses: codelytv/pr-size-labeler@095a41fca88b8764fd9e008ad269bcdb82bb38b9 # v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          xs_label: "size/xs"
          xs_max_size: "10"
          s_label: "size/s"
          s_max_size: "100"
          m_label: "size/m"
          m_max_size: "500"
          l_label: "size/l"
          l_max_size: "1000"
          xl_label: "size/xl"
          fail_if_xl: "false"
          message_if_xl: >
            This PR exceeds the recommended size of 1000 lines.
            Please consider splitting it into smaller, focused PRs to make
            it easier to review and reduce the risk of regressions.
          files_to_ignore: "requirements.txt *.lock"
 

What changed

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.