diff --git a/scripts/check_agent_review_workflow.py b/scripts/check_agent_review_workflow.py index 6f52cb6..16e7d5b 100644 --- a/scripts/check_agent_review_workflow.py +++ b/scripts/check_agent_review_workflow.py @@ -12,6 +12,7 @@ APPROVED_REVIEWER_SHAS = ( "856e474c1697f3897ccaa156f083e0b9504196e0", "ca0e322521d6d0f8b651546a7d935a93026d71f7", + "1aa9741927ec5546036506a0ec764e1b41b1a241", ) EXPECTED_CONTRACTS = ( "name: Review caller contract\n\non:\n pull_request:\n types: [opened, synchronize, reopened]\n paths:\n - '.github/workflows/agent-review.yaml'\n - '.github/agent-review.toml'\n - '.github/workflows/review-caller-contract.yaml'\n - 'scripts/check_agent_review_workflow.py'\n pull_request_target:\n types: [opened, synchronize, reopened]\n paths:\n - '.github/workflows/agent-review.yaml'\n - '.github/agent-review.toml'\n - '.github/workflows/review-caller-contract.yaml'\n - 'scripts/check_agent_review_workflow.py'\n push:\n branches: [main]\n paths:\n - '.github/workflows/agent-review.yaml'\n - '.github/agent-review.toml'\n - '.github/workflows/review-caller-contract.yaml'\n - 'scripts/check_agent_review_workflow.py'\n\npermissions:\n contents: read\n\njobs:\n bootstrap:\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n timeout-minutes: 5\n steps:\n - name: Check out proposed policy for unprivileged installation tests\n uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7\n with:\n persist-credentials: false\n - name: Check the proposed installation without provider secrets\n run: python3 -I scripts/check_agent_review_workflow.py --root . --output \"$GITHUB_OUTPUT\"\n contract:\n if: github.event_name != 'pull_request'\n runs-on: ubuntu-latest\n timeout-minutes: 5\n steps:\n - name: Check out the caller validator\n uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7\n with:\n repository: ${{ github.repository }}\n ref: ${{ github.sha }}\n path: trusted-validator\n persist-credentials: false\n sparse-checkout: scripts/check_agent_review_workflow.py\n sparse-checkout-cone-mode: false\n - name: Check out proposed policy as data\n uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7\n with:\n repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}\n ref: ${{ github.event.pull_request.head.sha || github.sha }}\n allow-unsafe-pr-checkout: true\n path: proposed\n persist-credentials: false\n sparse-checkout: |\n .github/workflows/agent-review.yaml\n .github/agent-review.toml\n .github/workflows/review-caller-contract.yaml\n sparse-checkout-cone-mode: false\n - name: Check approved source and checking workflow before loading shared code\n id: policy\n run: python3 -I trusted-validator/scripts/check_agent_review_workflow.py --root proposed --output \"$GITHUB_OUTPUT\"\n - name: Check out the approved immutable shared validator\n uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7\n with:\n repository: pipelab-org/agent-review\n ref: ${{ steps.policy.outputs.reviewer_sha }}\n path: trusted-reviewer\n persist-credentials: false\n sparse-checkout: scripts/agent_review_contract.py\n sparse-checkout-cone-mode: false\n - name: Validate caller and profile with approved shared code\n env:\n REVIEW_SOURCE_SHA: ${{ steps.policy.outputs.reviewer_sha }}\n run: |\n python3 -I - <<'PYCODE'\n import os\n import pathlib\n import runpy\n\n contract = runpy.run_path(\"trusted-reviewer/scripts/agent_review_contract.py\")\n root = pathlib.Path(\"proposed\")\n contract[\"validate_caller\"](\n root / \".github/workflows/agent-review.yaml\", os.environ[\"REVIEW_SOURCE_SHA\"],\n )\n contract[\"load_profile\"](root / \".github/agent-review.toml\")\n print(\"Review caller and profile contract passed\")\n PYCODE\n",