Skip to content

Fix skill-validation workflow failing when agents directory is deleted#13592

Merged
JeremyKuhne merged 1 commit intodotnet:mainfrom
JeremyKuhne:fix/skill-validation-find
Apr 21, 2026
Merged

Fix skill-validation workflow failing when agents directory is deleted#13592
JeremyKuhne merged 1 commit intodotnet:mainfrom
JeremyKuhne:fix/skill-validation-find

Conversation

@JeremyKuhne
Copy link
Copy Markdown
Member

@JeremyKuhne JeremyKuhne commented Apr 21, 2026

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.

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.
Copilot AI review requested due to automatic review settings April 21, 2026 17:56
@JeremyKuhne JeremyKuhne requested a review from a team as a code owner April 21, 2026 17:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a GitHub Actions workflow failure in .github/workflows/skill-validation.yml when the workflow’s filtering step removes .github/skills/ and/or .github/agents/, causing later find | wc pipelines to terminate the step under bash -e -o pipefail.

Changes:

  • Make the four find … | wc -l count pipelines resilient to missing directories by appending || true.
  • Ensure both the step summary output and the metadata/artifact output paths report counts as 0 instead of failing the job.

Copy link
Copy Markdown
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 24/24 dimensions clean — no findings.

Summary: The || true additions are correct and necessary. GitHub Actions bash steps run with -e -o pipefail, so when find returns non-zero (directory doesn't exist), pipefail propagates the failure through wc -l, and set -e aborts the step. The fix ensures the count command substitutions always succeed while still capturing the correct wc -l output (|| true produces no stdout, so the captured value is unaffected). This is idiomatic shell and consistent with the existing || echo "(none)" pattern used elsewhere in the same workflow (lines 110-112).

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

  • #13592 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Expert Code Review (on open) for issue #13592 · ● 2.2M

@JeremyKuhne JeremyKuhne merged commit 94dd443 into dotnet:main Apr 21, 2026
21 checks passed
@JeremyKuhne JeremyKuhne deleted the fix/skill-validation-find branch April 21, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants