Skip to content
Latchkey

Check Task Absolute Paths workflow (harbor-framework/terminal-bench)

The Check Task Absolute Paths workflow from harbor-framework/terminal-bench, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: harbor-framework/terminal-bench.github/workflows/check-task-absolute-path.ymlLicense Apache-2.0View source

What it does

This is the Check Task Absolute Paths workflow from the harbor-framework/terminal-bench 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: Check Task Absolute Paths

on:
  pull_request:
    paths:
      - "tasks/**/task.yaml"
      - "tasks/**/Dockerfile"
  push:
    branches:
      - main

jobs:
  check-task-absolute-path:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.13"

      - name: Install uv
        uses: astral-sh/setup-uv@v5

      - name: Check for relative paths in task instructions
        run: |
          if [ "${{ github.event_name }}" = "push" ]; then
            # For main branch pushes, check all tasks
            echo "Checking all tasks for absolute path usage"
            ALL_TASK_DIRS=$(find tasks -mindepth 1 -maxdepth 1 -type d | sort)
            if [ -z "$ALL_TASK_DIRS" ]; then
              echo "No task directories found"
              exit 0
            fi
            echo "Checking the following task directories:"
            echo "$ALL_TASK_DIRS"
            echo
            ./scripts_bash/check-task-absolute-path.sh $ALL_TASK_DIRS
          else
            # Run the absolute path check script on changed tasks
            CHANGED_TASK_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E 'tasks/.*/task.yaml$' || true)
            CHANGED_DOCKERFILE_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E 'tasks/.*/Dockerfile$' || true)

            # Get unique task directories from changed files
            CHANGED_TASK_DIRS=""
            for file in $CHANGED_TASK_FILES $CHANGED_DOCKERFILE_FILES; do
              if [[ "$file" == tasks/*/task.yaml ]]; then
                task_dir=$(dirname "$file")
              elif [[ "$file" == tasks/*/Dockerfile ]]; then
                task_dir=$(dirname "$file")
              else
                continue
              fi
              CHANGED_TASK_DIRS="$CHANGED_TASK_DIRS $task_dir"
            done

            CHANGED_TASK_DIRS=$(echo "$CHANGED_TASK_DIRS" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')

            if [ -z "$CHANGED_TASK_DIRS" ]; then
              echo "No task.yaml or Dockerfile files changed"
              exit 0
            fi

            echo "Checking the following task directories:"
            echo "$CHANGED_TASK_DIRS"
            echo

            ./scripts_bash/check-task-absolute-path.sh $CHANGED_TASK_DIRS
          fi

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Check Task Absolute Paths
 
on:
  pull_request:
    paths:
      - "tasks/**/task.yaml"
      - "tasks/**/Dockerfile"
  push:
    branches:
      - main
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  check-task-absolute-path:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
 
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          cache: 'pip'
          python-version: "3.13"
 
      - name: Install uv
        uses: astral-sh/setup-uv@v5
 
      - name: Check for relative paths in task instructions
        run: |
          if [ "${{ github.event_name }}" = "push" ]; then
            # For main branch pushes, check all tasks
            echo "Checking all tasks for absolute path usage"
            ALL_TASK_DIRS=$(find tasks -mindepth 1 -maxdepth 1 -type d | sort)
            if [ -z "$ALL_TASK_DIRS" ]; then
              echo "No task directories found"
              exit 0
            fi
            echo "Checking the following task directories:"
            echo "$ALL_TASK_DIRS"
            echo
            ./scripts_bash/check-task-absolute-path.sh $ALL_TASK_DIRS
          else
            # Run the absolute path check script on changed tasks
            CHANGED_TASK_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E 'tasks/.*/task.yaml$' || true)
            CHANGED_DOCKERFILE_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E 'tasks/.*/Dockerfile$' || true)
 
            # Get unique task directories from changed files
            CHANGED_TASK_DIRS=""
            for file in $CHANGED_TASK_FILES $CHANGED_DOCKERFILE_FILES; do
              if [[ "$file" == tasks/*/task.yaml ]]; then
                task_dir=$(dirname "$file")
              elif [[ "$file" == tasks/*/Dockerfile ]]; then
                task_dir=$(dirname "$file")
              else
                continue
              fi
              CHANGED_TASK_DIRS="$CHANGED_TASK_DIRS $task_dir"
            done
 
            CHANGED_TASK_DIRS=$(echo "$CHANGED_TASK_DIRS" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
 
            if [ -z "$CHANGED_TASK_DIRS" ]; then
              echo "No task.yaml or Dockerfile files changed"
              exit 0
            fi
 
            echo "Checking the following task directories:"
            echo "$CHANGED_TASK_DIRS"
            echo
 
            ./scripts_bash/check-task-absolute-path.sh $CHANGED_TASK_DIRS
          fi
 

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 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