diff --git a/.github/workflows/governed-pr-check.yml b/.github/workflows/governed-pr-check.yml index b87c9c0..da75211 100644 --- a/.github/workflows/governed-pr-check.yml +++ b/.github/workflows/governed-pr-check.yml @@ -44,6 +44,35 @@ jobs: run: | gh api "repos/${REPOSITORY}/pulls/${PR_NUMBER}/files?per_page=100" > pr-files.json + - name: Validate governed PR check tooling source + run: | + set -euo pipefail + PRIMARY_TOOL_PATH="governed-pr-check-tools/.github/scripts/governed_pr_check.py" + LEGACY_TOOL_PATH=".github/scripts/governed_pr_check.py" + + if [ -f "$PRIMARY_TOOL_PATH" ]; then + echo "[governed-pr-check] tooling path found: $PRIMARY_TOOL_PATH" + exit 0 + fi + + { + echo "## Governed PR Check hard-fail" + echo "Detected missing required tooling path: $PRIMARY_TOOL_PATH" + echo "Reason: wrong workflow revision/tooling source" + } >> "$GITHUB_STEP_SUMMARY" + + if [ -f "$LEGACY_TOOL_PATH" ]; then + echo "::error::workflow hard-fail: wrong workflow revision/tooling source. Expected $PRIMARY_TOOL_PATH but found $LEGACY_TOOL_PATH." + echo "::error::This reusable workflow is pinned to a legacy tooling revision that does not include the tool checkout directory." + echo "::error::Pin the caller to a fixed SHA that includes the governed-pr-check-tools checkout path (example: b250900...)." + else + echo "::error::workflow hard-fail: wrong workflow revision/tooling source. Expected $PRIMARY_TOOL_PATH." + echo "::error::No legacy path found at $LEGACY_TOOL_PATH either." + echo "::error::The governed PR check script is unavailable in this workflow source. Update reusable workflow source before rerunning." + fi + + exit 1 + - name: Run governed PR check run: | python3 governed-pr-check-tools/.github/scripts/governed_pr_check.py \