Spaces:
Running
Running
Add partner hosted receipt validation action (#51)
Browse filesFiles changed (3)
103 unmodified lines104105106107108109103 unmodified lines`1` means it does not. This validates structure only and does not turn asynthetic example into run evidence or authenticate a real receipt.If it passes, returns a redacted failure or gives you confusing friction,[send the public run](https://github.com/noqt/Lumi-Eggcracker/issues/new?template=hosted_probe_result.yml).The short form asks for the workflow URL and what happened. That is useful103 unmodified lines104105106107108109110111112113114115116117118119120121122123103 unmodified lines`1` means it does not. This validates structure only and does not turn asynthetic example into run evidence or authenticate a real receipt.A partner repository can call the same local validator as a pinned compositeaction:```yaml- uses: noqt/Lumi-Eggcracker/actions/validate-hosted-proof-receipt@<40-character-commit-sha>with:receipt: receipt.json```Replace the placeholder with an immutable commit containing the action. Thereceipt path is passed as an environment value rather than interpolated into ashell command. The action uploads nothing and prints only the bounded validatorresult; it still validates structure rather than authenticating a run.If it passes, returns a redacted failure or gives you confusing friction,[send the public run](https://github.com/noqt/Lumi-Eggcracker/issues/new?template=hosted_probe_result.yml).The short form asks for the workflow URL and what happened. That is useful
123456789101112131415name: Validate Lumi Eggcracker hosted-proof receiptdescription: Validate one local receipt against the bounded public v1 schema without uploading itinputs: receipt: description: Path to one local hosted-proof receipt JSON object required: trueruns: using: composite steps: - name: Validate v1 receipt locally shell: bash --noprofile --norc -euo pipefail {0} env: RECEIPT_PATH: ${{ inputs.receipt }} run: | python3 "$GITHUB_ACTION_PATH/../../scripts/validate_hosted_proof_receipt.py" "$RECEIPT_PATH"12345678910111213141516171819202122232425262728293031323334353637383940414243from __future__ import annotations
import unittestfrom pathlib import Path
import yaml
ROOT = Path(__file__).resolve().parents[1]ACTION = ROOT / "actions" / "validate-hosted-proof-receipt" / "action.yml"
class HostedProofReceiptActionTests(unittest.TestCase): def setUp(self) -> None: self.metadata = yaml.safe_load(ACTION.read_text(encoding="utf-8"))
def test_action_exposes_only_one_required_local_receipt_input(self) -> None: self.assertEqual( { "receipt": { "description": "Path to one local hosted-proof receipt JSON object", "required": True, } }, self.metadata["inputs"], ) self.assertNotIn("outputs", self.metadata)
def test_action_passes_the_path_by_environment_to_the_local_validator(self) -> None: self.assertEqual("composite", self.metadata["runs"]["using"]) self.assertEqual(1, len(self.metadata["runs"]["steps"])) step = self.metadata["runs"]["steps"][0] self.assertEqual("bash --noprofile --norc -euo pipefail {0}", step["shell"]) self.assertEqual({"RECEIPT_PATH": "${{ inputs.receipt }}"}, step["env"]) self.assertEqual( 'python3 "$GITHUB_ACTION_PATH/../../scripts/validate_hosted_proof_receipt.py" ' '"$RECEIPT_PATH"\n', step["run"], ) self.assertNotIn("inputs.receipt", step["run"])
if __name__ == "__main__": unittest.main()TRY_IT.md+14
actions/validate-hosted-proof-receipt/action.ymlAdded+15
tests/test_receipt_action.pyAdded+43