Skip to content
Latchkey

CodeQL 2 workflow (corazawaf/coraza)

The CodeQL 2 workflow from corazawaf/coraza, 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: corazawaf/coraza.github/workflows/codeql-analysis.ymlLicense Apache-2.0View source

What it does

This is the CodeQL 2 workflow from the corazawaf/coraza 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: "CodeQL 2"
on:
  pull_request:
  schedule:
    - cron: '0 6 * * 6'

permissions: {}

concurrency:
  group: codeql-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest
    permissions:
      security-events: write
      contents: read

    steps:
    - name: Checkout repository
      uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6

    - name: Initialize CodeQL
      uses: github/codeql-action/init@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4
      with:
        languages: go

    - name: Autobuild
      uses: github/codeql-action/autobuild@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4

The same workflow, on Latchkey

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

name: "CodeQL 2"
on:
  pull_request:
  schedule:
    - cron: '0 6 * * 6'
 
permissions: {}
 
concurrency:
  group: codeql-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
 
jobs:
  analyze:
    timeout-minutes: 30
    name: Analyze
    runs-on: latchkey-small
    permissions:
      security-events: write
      contents: read
 
    steps:
    - name: Checkout repository
      uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
 
    - name: Initialize CodeQL
      uses: github/codeql-action/init@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4
      with:
        languages: go
 
    - name: Autobuild
      uses: github/codeql-action/autobuild@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4
 
    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4
 

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