Skip to content
Latchkey

Validate Agent Skill workflow (coreyhaines31/marketingskills)

The Validate Agent Skill workflow from coreyhaines31/marketingskills, explained and optimized by Latchkey.

B

CI health: B - good

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: coreyhaines31/marketingskills.github/workflows/validate-skill.ymlLicense MITView source

What it does

This is the Validate Agent Skill workflow from the coreyhaines31/marketingskills repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

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

The workflow

workflow (.yml)
name: Validate Agent Skill

on:
  push:
    branches: [main]
    paths:
      - "**/SKILL.md"
  pull_request:
    branches: [main]
    paths:
      - "**/SKILL.md"

concurrency:
  group: validate-skill-${{ github.ref }}
  cancel-in-progress: true

jobs:
  detect-changes:
    runs-on: ubuntu-slim
    if: github.event.pull_request.draft != true && github.actor != 'dependabot[bot]'
    outputs:
      skills: ${{ steps.changed-skills.outputs.skills }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Get changed skills
        id: changed-skills
        run: |
          if [ "${{ github.event_name }}" = "pull_request" ]; then
            BASE=${{ github.event.pull_request.base.sha }}
            HEAD=${{ github.event.pull_request.head.sha }}
          else
            BASE=${{ github.event.before }}
            HEAD=${{ github.event.after }}
          fi

          # Find changed SKILL.md files and extract skill directories
          SKILLS=$(git diff --name-only $BASE $HEAD | \
            grep 'SKILL.md$' | \
            xargs -I {} dirname {} | \
            sort -u | \
            jq -R -s -c 'split("\n") | map(select(length > 0))')

          echo "skills=$SKILLS" >> $GITHUB_OUTPUT
          echo "Changed skills: $SKILLS"

  validate:
    needs: detect-changes
    if: needs.detect-changes.outputs.skills != '[]'
    runs-on: ubuntu-slim
    strategy:
      fail-fast: false
      matrix:
        skill: ${{ fromJson(needs.detect-changes.outputs.skills) }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Validate ${{ matrix.skill }}
        uses: Flash-Brew-Digital/validate-skill@v1
        with:
          path: ${{ matrix.skill }}

The same workflow, on Latchkey

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

name: Validate Agent Skill
 
on:
  push:
    branches: [main]
    paths:
      - "**/SKILL.md"
  pull_request:
    branches: [main]
    paths:
      - "**/SKILL.md"
 
concurrency:
  group: validate-skill-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  detect-changes:
    timeout-minutes: 30
    runs-on: ubuntu-slim
    if: github.event.pull_request.draft != true && github.actor != 'dependabot[bot]'
    outputs:
      skills: ${{ steps.changed-skills.outputs.skills }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
        with:
          fetch-depth: 0
 
      - name: Get changed skills
        id: changed-skills
        run: |
          if [ "${{ github.event_name }}" = "pull_request" ]; then
            BASE=${{ github.event.pull_request.base.sha }}
            HEAD=${{ github.event.pull_request.head.sha }}
          else
            BASE=${{ github.event.before }}
            HEAD=${{ github.event.after }}
          fi
 
          # Find changed SKILL.md files and extract skill directories
          SKILLS=$(git diff --name-only $BASE $HEAD | \
            grep 'SKILL.md$' | \
            xargs -I {} dirname {} | \
            sort -u | \
            jq -R -s -c 'split("\n") | map(select(length > 0))')
 
          echo "skills=$SKILLS" >> $GITHUB_OUTPUT
          echo "Changed skills: $SKILLS"
 
  validate:
    timeout-minutes: 30
    needs: detect-changes
    if: needs.detect-changes.outputs.skills != '[]'
    runs-on: ubuntu-slim
    strategy:
      fail-fast: false
      matrix:
        skill: ${{ fromJson(needs.detect-changes.outputs.skills) }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
 
      - name: Validate ${{ matrix.skill }}
        uses: Flash-Brew-Digital/validate-skill@v1
        with:
          path: ${{ matrix.skill }}

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

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

Actions used in this workflow