Skip to content
Latchkey

CI workflow (openai/openai-go)

The CI workflow from openai/openai-go, explained and optimized by Latchkey.

C

CI health: C - fair

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: openai/openai-go.github/workflows/detect-breaking-changes.ymlLicense Apache-2.0View source

What it does

This is the CI workflow from the openai/openai-go 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: CI
on:
  pull_request:
    branches:
      - main
      - next

permissions:
  contents: read

jobs:
  detect_breaking_changes:
    runs-on: 'ubuntu-latest'
    name: detect-breaking-changes
    if: github.repository == 'openai/openai-go'
    steps:
      - name: Calculate fetch-depth
        env:
          PR_COMMITS: ${{ github.event.pull_request.commits }}
        run: |
          echo "FETCH_DEPTH=$(expr "$PR_COMMITS" + 1)" >> "$GITHUB_ENV"

      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          # Ensure we can check out the pull request base in the script below.
          fetch-depth: ${{ env.FETCH_DEPTH }}

      - name: Setup go
        uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
        with:
          go-version-file: ./go.mod

      - name: Detect breaking changes
        env:
          BASE_SHA: ${{ github.event.pull_request.base.sha }}
        run: |
          # Try to check out previous versions of the breaking change detection script. This ensures that
          # we still detect breaking changes when entire files and their tests are removed.
          git checkout "$BASE_SHA" -- ./scripts/detect-breaking-changes 2>/dev/null || true
          ./scripts/detect-breaking-changes "$BASE_SHA"

The same workflow, on Latchkey

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

name: CI
on:
  pull_request:
    branches:
      - main
      - next
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  detect_breaking_changes:
    timeout-minutes: 30
    runs-on: 'ubuntu-latest'
    name: detect-breaking-changes
    if: github.repository == 'openai/openai-go'
    steps:
      - name: Calculate fetch-depth
        env:
          PR_COMMITS: ${{ github.event.pull_request.commits }}
        run: |
          echo "FETCH_DEPTH=$(expr "$PR_COMMITS" + 1)" >> "$GITHUB_ENV"
 
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          # Ensure we can check out the pull request base in the script below.
          fetch-depth: ${{ env.FETCH_DEPTH }}
 
      - name: Setup go
        uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
        with:
          go-version-file: ./go.mod
 
      - name: Detect breaking changes
        env:
          BASE_SHA: ${{ github.event.pull_request.base.sha }}
        run: |
          # Try to check out previous versions of the breaking change detection script. This ensures that
          # we still detect breaking changes when entire files and their tests are removed.
          git checkout "$BASE_SHA" -- ./scripts/detect-breaking-changes 2>/dev/null || true
          ./scripts/detect-breaking-changes "$BASE_SHA"
 

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