Switch skill CI checks to vally lint

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Aaron Powell
2026-06-17 16:56:47 +10:00
parent ea9fc8f958
commit ffa838e2da
3 changed files with 75 additions and 131 deletions
+14 -14
View File
@@ -1,12 +1,12 @@
name: Skill Validator — PR Comment name: Vally Lint — PR Comment
# Posts results from the "Skill Validator — PR Gate" workflow. # Posts results from the "Vally Lint — PR Gate" workflow.
# Runs with write permissions but never checks out PR code, # Runs with write permissions but never checks out PR code,
# so it is safe for fork PRs. # so it is safe for fork PRs.
on: on:
workflow_run: workflow_run:
workflows: ["Skill Validator — PR Gate"] workflows: ["Vally Lint — PR Gate"]
types: [completed] types: [completed]
permissions: permissions:
@@ -22,7 +22,7 @@ jobs:
- name: Download results artifact - name: Download results artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: with:
name: skill-validator-results name: vally-lint-results
run-id: ${{ github.event.workflow_run.id }} run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }} github-token: ${{ github.token }}
@@ -34,11 +34,11 @@ jobs:
const managedLabels = { const managedLabels = {
'skill-check-warning': { 'skill-check-warning': {
color: 'FBCA04', color: 'FBCA04',
description: 'Skill validator reported warnings' description: 'Vally lint reported warnings'
}, },
'skill-check-error': { 'skill-check-error': {
color: 'B60205', color: 'B60205',
description: 'Skill validator reported errors' description: 'Vally lint reported errors'
} }
}; };
@@ -105,9 +105,9 @@ jobs:
const agentCount = parseInt(fs.readFileSync('agent-count.txt', 'utf8').trim(), 10); const agentCount = parseInt(fs.readFileSync('agent-count.txt', 'utf8').trim(), 10);
const totalChecked = skillCount + agentCount; const totalChecked = skillCount + agentCount;
const marker = '<!-- skill-validator-results -->'; const marker = '<!-- vally-lint-results -->';
const rawOutput = fs.existsSync('sv-output.txt') const rawOutput = fs.existsSync('vally-output.txt')
? fs.readFileSync('sv-output.txt', 'utf8') ? fs.readFileSync('vally-output.txt', 'utf8')
: ''; : '';
const output = rawOutput.replace(/\x1b\[[0-9;]*m/g, '').trim(); const output = rawOutput.replace(/\x1b\[[0-9;]*m/g, '').trim();
@@ -171,7 +171,7 @@ jobs:
]; ];
const findingsTable = summaryLines.length === 0 const findingsTable = summaryLines.length === 0
? ['_No findings were emitted by the validator._'] ? ['_No findings were emitted by the linter._']
: [ : [
'| Level | Finding |', '| Level | Finding |',
'|---|---|', '|---|---|',
@@ -190,7 +190,7 @@ jobs:
const body = [ const body = [
marker, marker,
'## 🔍 Skill Validator Results', '## 🔍 Vally Lint Results',
'', '',
`**${verdict}**`, `**${verdict}**`,
'', '',
@@ -203,16 +203,16 @@ jobs:
...findingsTable, ...findingsTable,
'', '',
'<details>', '<details>',
'<summary>Full validator output</summary>', '<summary>Full linter output</summary>',
'', '',
'```text', '```text',
output || 'No validator output captured.', output || 'No linter output captured.',
'```', '```',
'', '',
'</details>', '</details>',
'', '',
exitCode !== '0' exitCode !== '0'
? '> **Note:** The validator returned a non-zero exit code. Please review the findings above before merge.' ? '> **Note:** Vally lint returned a non-zero exit code. Please review the findings above before merge.'
: '', : '',
].join('\n'); ].join('\n');
+40 -62
View File
@@ -1,4 +1,4 @@
name: Skill Validator — PR Gate name: Vally Lint — PR Gate
on: on:
pull_request: pull_request:
@@ -22,37 +22,10 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
# ── Download & cache skill-validator ────────────────────────── - name: Setup Node.js
- name: Get cache key date uses: actions/setup-node@3235b876344febd2b5f2414c5edc3a01b7f10a06 # v4.2.0
id: cache-date
run: echo "date=$(date +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
- name: Restore skill-validator from cache
id: cache-sv
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with: with:
path: .skill-validator node-version: 20
key: skill-validator-linux-x64-${{ steps.cache-date.outputs.date }}
restore-keys: |
skill-validator-linux-x64-
- name: Download skill-validator
if: steps.cache-sv.outputs.cache-hit != 'true'
run: |
mkdir -p .skill-validator
curl -fsSL \
"https://github.com/dotnet/skills/releases/download/skill-validator-nightly/skill-validator-linux-x64.tar.gz" \
-o .skill-validator/skill-validator-linux-x64.tar.gz
tar -xzf .skill-validator/skill-validator-linux-x64.tar.gz -C .skill-validator
rm .skill-validator/skill-validator-linux-x64.tar.gz
chmod +x .skill-validator/skill-validator
- name: Save skill-validator to cache
if: steps.cache-sv.outputs.cache-hit != 'true'
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: .skill-validator
key: skill-validator-linux-x64-${{ steps.cache-date.outputs.date }}
# ── Detect changed skills & agents ──────────────────────────── # ── Detect changed skills & agents ────────────────────────────
- name: Detect changed skills and agents - name: Detect changed skills and agents
@@ -111,8 +84,8 @@ jobs:
echo "Found $SKILL_COUNT skill dir(s) and $AGENT_COUNT agent file(s) to check." echo "Found $SKILL_COUNT skill dir(s) and $AGENT_COUNT agent file(s) to check."
# ── Run skill-validator check ───────────────────────────────── # ── Run vally lint check ───────────────────────────────────────
- name: Run skill-validator check - name: Run vally lint check
id: check id: check
if: steps.detect.outputs.total != '0' if: steps.detect.outputs.total != '0'
env: env:
@@ -134,53 +107,58 @@ jobs:
done <<< "$AGENT_FILES_RAW" done <<< "$AGENT_FILES_RAW"
fi fi
CMD=(.skill-validator/skill-validator check --verbose) EXIT_CODE=0
: > vally-output.txt
if [ ${#SKILL_DIRS[@]} -gt 0 ]; then if [ ${#SKILL_DIRS[@]} -eq 0 ] && [ ${#AGENT_FILES[@]} -eq 0 ]; then
CMD+=(--skills "${SKILL_DIRS[@]}") echo "No skills or agents to validate." | tee -a vally-output.txt
fi fi
for skill_dir in "${SKILL_DIRS[@]}"; do
echo "### Linting ${skill_dir}" | tee -a vally-output.txt
set +e
OUTPUT=$(npx --yes @microsoft/vally-cli lint "$skill_dir" --verbose 2>&1)
CMD_EXIT=$?
set -e
echo "$OUTPUT" | tee -a vally-output.txt
echo "" >> vally-output.txt
if [ "$CMD_EXIT" -ne 0 ]; then
EXIT_CODE=1
fi
done
if [ ${#AGENT_FILES[@]} -gt 0 ]; then if [ ${#AGENT_FILES[@]} -gt 0 ]; then
CMD+=(--agents "${AGENT_FILES[@]}") {
echo "### Agent files detected (not linted by vally)"
echo "️ Vally currently lints SKILL.md content. Agent files were detected but skipped:"
printf '%s\n' "${AGENT_FILES[@]}"
echo ""
} | tee -a vally-output.txt
fi fi
printf 'Running: '
printf '%q ' "${CMD[@]}"
echo
# Capture output; don't fail the workflow (warn-only mode)
set +e
OUTPUT=$("${CMD[@]}" 2>&1)
EXIT_CODE=$?
set -e
echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT" echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT"
# Save output to file (multi-line safe)
echo "$OUTPUT" > sv-output.txt
echo "$OUTPUT"
# ── Upload results for the commenting workflow ──────────────── # ── Upload results for the commenting workflow ────────────────
- name: Save metadata - name: Save metadata
if: always() if: always()
run: | run: |
mkdir -p sv-results mkdir -p vally-results
echo "${{ github.event.pull_request.number }}" > sv-results/pr-number.txt echo "${{ github.event.pull_request.number }}" > vally-results/pr-number.txt
echo "${{ steps.detect.outputs.total }}" > sv-results/total.txt echo "${{ steps.detect.outputs.total }}" > vally-results/total.txt
echo "${{ steps.detect.outputs.skill_count }}" > sv-results/skill-count.txt echo "${{ steps.detect.outputs.skill_count }}" > vally-results/skill-count.txt
echo "${{ steps.detect.outputs.agent_count }}" > sv-results/agent-count.txt echo "${{ steps.detect.outputs.agent_count }}" > vally-results/agent-count.txt
echo "${{ steps.check.outputs.exit_code }}" > sv-results/exit-code.txt echo "${{ steps.check.outputs.exit_code }}" > vally-results/exit-code.txt
if [ -f sv-output.txt ]; then if [ -f vally-output.txt ]; then
cp sv-output.txt sv-results/sv-output.txt cp vally-output.txt vally-results/vally-output.txt
fi fi
- name: Upload results - name: Upload results
if: always() if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with: with:
name: skill-validator-results name: vally-lint-results
path: sv-results/ path: vally-results/
retention-days: 1 retention-days: 1
- name: Post skip notice if no skills changed - name: Post skip notice if no skills changed
+21 -55
View File
@@ -19,71 +19,37 @@ jobs:
with: with:
fetch-depth: 0 # full history for git-log author fallback fetch-depth: 0 # full history for git-log author fallback
# ── Download & cache skill-validator ────────────────────────── - name: Setup Node.js
- name: Get cache key date uses: actions/setup-node@3235b876344febd2b5f2414c5edc3a01b7f10a06 # v4.2.0
id: cache-date
run: echo "date=$(date +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
- name: Restore skill-validator from cache
id: cache-sv
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with: with:
path: .skill-validator node-version: 20
key: skill-validator-linux-x64-${{ steps.cache-date.outputs.date }}
restore-keys: |
skill-validator-linux-x64-
- name: Download skill-validator
if: steps.cache-sv.outputs.cache-hit != 'true'
run: |
mkdir -p .skill-validator
curl -fsSL \
"https://github.com/dotnet/skills/releases/download/skill-validator-nightly/skill-validator-linux-x64.tar.gz" \
-o .skill-validator/skill-validator-linux-x64.tar.gz
tar -xzf .skill-validator/skill-validator-linux-x64.tar.gz -C .skill-validator
rm .skill-validator/skill-validator-linux-x64.tar.gz
chmod +x .skill-validator/skill-validator
- name: Save skill-validator to cache
if: steps.cache-sv.outputs.cache-hit != 'true'
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: .skill-validator
key: skill-validator-linux-x64-${{ steps.cache-date.outputs.date }}
# ── Run full scan ───────────────────────────────────────────── # ── Run full scan ─────────────────────────────────────────────
- name: Run skill-validator check on all skills - name: Run vally lint on all skills
id: check-skills id: check-skills
run: | run: |
set +e set +e
set -o pipefail set -o pipefail
.skill-validator/skill-validator check \ npx --yes @microsoft/vally-cli lint ./skills --verbose 2>&1 | tee vally-skills-output.txt
--skills ./skills \
--verbose \
2>&1 | tee sv-skills-output.txt
echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT" echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
set +o pipefail set +o pipefail
set -e set -e
- name: Run skill-validator check on all agents - name: Note agent scan status
id: check-agents id: check-agents
run: | run: |
set +e
set -o pipefail
AGENT_FILES=$(find agents -name '*.agent.md' -type f 2>/dev/null | tr '\n' ' ') AGENT_FILES=$(find agents -name '*.agent.md' -type f 2>/dev/null | tr '\n' ' ')
if [ -n "$AGENT_FILES" ]; then if [ -n "$AGENT_FILES" ]; then
.skill-validator/skill-validator check \ {
--agents $AGENT_FILES \ echo "️ Vally currently lints SKILL.md content."
--verbose \ echo "️ Agent files are detected but excluded from this scan:"
2>&1 | tee sv-agents-output.txt echo "$AGENT_FILES"
echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT" } > vally-agents-output.txt
else else
echo "No agent files found." echo "No agent files found."
echo "" > sv-agents-output.txt echo "" > vally-agents-output.txt
echo "exit_code=0" >> "$GITHUB_OUTPUT" echo "exit_code=0" >> "$GITHUB_OUTPUT"
fi fi
set +o pipefail
set -e
# ── Build report with author attribution ────────────────────── # ── Build report with author attribution ──────────────────────
- name: Build quality report - name: Build quality report
@@ -147,18 +113,18 @@ jobs:
} }
} }
// ── Parse skill-validator output ────────────────────── // ── Parse vally lint output ───────────────────────────
// The output is a text report; we preserve it as-is and // The output is a text report; we preserve it as-is and
// augment it with author info in the summary. // augment it with author info in the summary.
const skillsOutput = fs.readFileSync('sv-skills-output.txt', 'utf8').trim(); const skillsOutput = fs.readFileSync('vally-skills-output.txt', 'utf8').trim();
const agentsOutput = fs.existsSync('sv-agents-output.txt') const agentsOutput = fs.existsSync('vally-agents-output.txt')
? fs.readFileSync('sv-agents-output.txt', 'utf8').trim() ? fs.readFileSync('vally-agents-output.txt', 'utf8').trim()
: ''; : '';
const codeowners = parseCodeowners(); const codeowners = parseCodeowners();
// Count findings // Count findings
// The skill-validator uses emoji markers: ❌ for errors, ⚠ for warnings, for advisories // Vally lint uses emoji markers: ❌ for errors, ⚠ for warnings, for advisories
const combined = skillsOutput + '\n' + agentsOutput; const combined = skillsOutput + '\n' + agentsOutput;
const errorCount = (combined.match(/❌/g) || []).length; const errorCount = (combined.match(/❌/g) || []).length;
const warningCount = (combined.match(/⚠/g) || []).length; const warningCount = (combined.match(/⚠/g) || []).length;
@@ -179,7 +145,7 @@ jobs:
} catch {} } catch {}
// ── Build author-attributed summary ─────────────────── // ── Build author-attributed summary ───────────────────
// Extract per-resource blocks from output. The validator // Extract per-resource blocks from output. The linter
// prints skill names as headers — we annotate them with // prints skill names as headers — we annotate them with
// the resolved owner. // the resolved owner.
function annotateWithAuthors(output, kind) { function annotateWithAuthors(output, kind) {
@@ -238,10 +204,10 @@ jobs:
`| ️ Advisories | ${advisoryCount} |`, '', `| ️ Advisories | ${advisoryCount} |`, '',
'---', '---',
]; ];
const footer = `\n---\n\n_Generated by the [Skill Validator nightly scan](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/skill-quality-report.yml)._`; const footer = `\n---\n\n_Generated by the [Vally lint nightly scan](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/skill-quality-report.yml)._`;
const skillsBlock = makeDetailsBlock('Skills', 'Full skill-validator output for skills', annotatedSkills); const skillsBlock = makeDetailsBlock('Skills', 'Full vally lint output for skills', annotatedSkills);
const agentsBlock = makeDetailsBlock('Agents', 'Full skill-validator output for agents', annotatedAgents); const agentsBlock = makeDetailsBlock('Agents', 'Agent scan notes', annotatedAgents);
// Try full inline body first // Try full inline body first
const fullBody = summaryLines.join('\n') + '\n\n' + skillsBlock + '\n\n' + agentsBlock + footer; const fullBody = summaryLines.join('\n') + '\n\n' + skillsBlock + '\n\n' + agentsBlock + footer;