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.
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
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.