From ebfc1c14aaaff771f204e2e9d104a32714acdedd Mon Sep 17 00:00:00 2001 From: ArchonVII Date: Mon, 1 Jun 2026 20:38:41 -0500 Subject: [PATCH] fix(required-gate): honor disabled validation inputs Gate the final decision job on both caller inputs and classifier outputs for optional dependency review, workflow validation, and policy validation jobs. Also keeps the PR contract CLI importable under Vitest by relying on the documented node-based invocation path. Fixes #40 --- .github/workflows/repo-required-gate.yml | 6 +++--- scripts/pr-contract.mjs | 1 - scripts/workflow-structure.test.mjs | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/repo-required-gate.yml b/.github/workflows/repo-required-gate.yml index b78ca4e..07b1fed 100644 --- a/.github/workflows/repo-required-gate.yml +++ b/.github/workflows/repo-required-gate.yml @@ -576,9 +576,9 @@ jobs: OK: ${{ needs.detect.outputs.ok }} RUN_NODE_CI: ${{ needs.detect.outputs.run-node-ci }} RUN_PYTHON_CI: ${{ needs.detect.outputs.run-python-ci }} - RUN_DEPENDENCY_REVIEW: ${{ needs.detect.outputs.run-dependency-review }} - RUN_WORKFLOW_VALIDATION: ${{ needs.detect.outputs.run-workflow-validation }} - RUN_POLICY_VALIDATION: ${{ needs.detect.outputs.run-policy-validation }} + RUN_DEPENDENCY_REVIEW: ${{ inputs.run-dependency-review && needs.detect.outputs.run-dependency-review == 'true' }} + RUN_WORKFLOW_VALIDATION: ${{ inputs.run-workflow-validation && needs.detect.outputs.run-workflow-validation == 'true' }} + RUN_POLICY_VALIDATION: ${{ inputs.run-policy-validation && needs.detect.outputs.run-policy-validation == 'true' }} RUN_SNAPSHOT_VALIDATION: ${{ needs.detect.outputs.run-snapshot-validation }} DETECT_RESULT: ${{ needs.detect.result }} CONTRACT_RESULT: ${{ needs.pr-contract.result }} diff --git a/scripts/pr-contract.mjs b/scripts/pr-contract.mjs index ea945b9..709d210 100644 --- a/scripts/pr-contract.mjs +++ b/scripts/pr-contract.mjs @@ -1,4 +1,3 @@ -#!/usr/bin/env node import { execFileSync } from 'node:child_process'; import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; diff --git a/scripts/workflow-structure.test.mjs b/scripts/workflow-structure.test.mjs index 901ea5a..4bf1470 100644 --- a/scripts/workflow-structure.test.mjs +++ b/scripts/workflow-structure.test.mjs @@ -88,6 +88,21 @@ describe('repo-required-gate workflow node delegation', () => { } }); + it('honors optional validation inputs in the decision job', () => { + const body = readWorkflow('repo-required-gate'); + const block = workflowJobBlock(body, 'decision'); + + expect(block).toContain( + "RUN_DEPENDENCY_REVIEW: ${{ inputs.run-dependency-review && needs.detect.outputs.run-dependency-review == 'true' }}", + ); + expect(block).toContain( + "RUN_WORKFLOW_VALIDATION: ${{ inputs.run-workflow-validation && needs.detect.outputs.run-workflow-validation == 'true' }}", + ); + expect(block).toContain( + "RUN_POLICY_VALIDATION: ${{ inputs.run-policy-validation && needs.detect.outputs.run-policy-validation == 'true' }}", + ); + }); + it('declares the doc-only inputs passed to the shared PR contract validator', () => { const body = readWorkflow('repo-required-gate');