From 0dd90014f7797f866aa86c69f8d5d1be22938095 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Tue, 21 Apr 2026 10:53:17 -0700 Subject: [PATCH] Fix skill-validation workflow failing when agents directory is deleted The filter step deletes .github/agents/ when no agent files are changed in the PR. Later, the step summary and metadata steps run: find .github/agents -name '*.agent.md' 2>/dev/null | wc -l find returns exit code 1 on a missing directory. 2>/dev/null suppresses the error message but not the exit code. Under -o pipefail (set by the shell: bash --noprofile --norc -e -o pipefail), the pipeline exit code is 1. Under set -e, this terminates the script before reaching exit \\\, causing the step to report failure even though the validator printed 'All checks passed'. Add || true to all four find|wc pipelines so a missing directory produces a count of 0 instead of aborting the script. Fixes the same issue for .github/skills/ which can also be deleted when only agent files are changed. --- .github/workflows/skill-validation.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/skill-validation.yml b/.github/workflows/skill-validation.yml index c9f690405c7..3d739411033 100644 --- a/.github/workflows/skill-validation.yml +++ b/.github/workflows/skill-validation.yml @@ -186,8 +186,8 @@ jobs: if [ "$rc" -eq 0 ]; then echo "All checks passed." echo "" - skill_count=$(find .github/skills -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l) - agent_count=$(find .github/agents -name '*.agent.md' 2>/dev/null | wc -l) + skill_count=$(find .github/skills -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l || true) + agent_count=$(find .github/agents -name '*.agent.md' 2>/dev/null | wc -l || true) echo "Validated **${skill_count}** skill(s) and **${agent_count}** agent(s)." else for f in skill-check-skills.txt skill-check-agents.txt; do @@ -217,8 +217,8 @@ jobs: if [ -z "$exit_code" ]; then exit_code=0 else - skill_count=$(find .github/skills -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l) - agent_count=$(find .github/agents -name '*.agent.md' 2>/dev/null | wc -l) + skill_count=$(find .github/skills -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l || true) + agent_count=$(find .github/agents -name '*.agent.md' 2>/dev/null | wc -l || true) total=$((skill_count + agent_count)) fi echo "${{ github.event.pull_request.number }}" > sv-results/pr-number.txt