Skip to content
Latchkey

PR Title Check workflow (NVIDIA/tilus)

The PR Title Check workflow from NVIDIA/tilus, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, 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: NVIDIA/tilus.github/workflows/check-pr-title.yamlLicense Apache-2.0View source

What it does

This is the PR Title Check workflow from the NVIDIA/tilus 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 Title Check

on:
  pull_request:
    types: [opened, edited, synchronize]

jobs:
  check-title:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Check PR Title Format
        id: check-title
        run: |
          #!/bin/bash
          MAX_TITLE_LENGTH=72
          PR_TITLE='${{ github.event.pull_request.title }}'

          # Ensure the title matches the format [Category1][Category2]...[CategoryN] A sentence
          if [[ ! "$PR_TITLE" =~ ^(\[[^\]]+\])+ ]]; then
            echo "::error::PR title must be in the format '[Category1][Category2]...[CategoryN] A sentence'."
            exit 1
          fi

          # Ensure there is a space after the last category
          if [[ ! "$PR_TITLE" =~ ^(\[[^\]]+\])+\ .+ ]]; then
            echo "::error::PR title must contain a space after the last category."
            exit 1
          fi

          # Ensure the title length is within the limit
          if (( ${#PR_TITLE} > MAX_TITLE_LENGTH )); then
            echo "::error::PR title exceeds the maximum length of $MAX_TITLE_LENGTH characters."
            exit 1
          fi

          echo "PR title format and length are valid."

      - name: Set status to success
        if: success()
        run: echo "Title check passed."

The same workflow, on Latchkey

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

name: PR Title Check
 
on:
  pull_request:
    types: [opened, edited, synchronize]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  check-title:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
 
      - name: Check PR Title Format
        id: check-title
        run: |
          #!/bin/bash
          MAX_TITLE_LENGTH=72
          PR_TITLE='${{ github.event.pull_request.title }}'
 
          # Ensure the title matches the format [Category1][Category2]...[CategoryN] A sentence
          if [[ ! "$PR_TITLE" =~ ^(\[[^\]]+\])+ ]]; then
            echo "::error::PR title must be in the format '[Category1][Category2]...[CategoryN] A sentence'."
            exit 1
          fi
 
          # Ensure there is a space after the last category
          if [[ ! "$PR_TITLE" =~ ^(\[[^\]]+\])+\ .+ ]]; then
            echo "::error::PR title must contain a space after the last category."
            exit 1
          fi
 
          # Ensure the title length is within the limit
          if (( ${#PR_TITLE} > MAX_TITLE_LENGTH )); then
            echo "::error::PR title exceeds the maximum length of $MAX_TITLE_LENGTH characters."
            exit 1
          fi
 
          echo "PR title format and length are valid."
 
      - name: Set status to success
        if: success()
        run: echo "Title check passed."
 

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.

Actions used in this workflow