Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/workflows/grc-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ jobs:
echo "sha256=$(cat $BUNDLE.sha256)" >> "$GITHUB_OUTPUT"

# ---------- STEP 5: UPLOAD ----------
# The receipt is written AFTER the bundle upload because it pins the
# bundle's S3 version ID, which only exists once the object is in the vault.
- name: Upload to evidence vault
if: always()
run: |
Expand All @@ -104,4 +106,29 @@ jobs:
--bucket "${{ vars.EVIDENCE_VAULT }}" --key "$KEY" \
--query VersionId --output text)

cat > receipt.json <<-EOF
cat > receipt.json <<-EOF
{
"run_id": "${{ github.run_id }}",
"commit": "${{ github.sha }}",
"event": "${{ github.event_name }}",
"gate_outcome": "${{ steps.gate.outcome }}",
"bundle_key": "$KEY",
"version_id": "$VERSION_ID",
"sha256": "${{ steps.sign.outputs.sha256 }}"
}
EOF

aws s3 cp receipt.json "s3://${{ vars.EVIDENCE_VAULT }}/runs/${{ github.run_id }}/receipt.json"
echo "Receipt uploaded; bundle pinned to version $VERSION_ID"

# ---------- STEP 6: ENFORCE ----------
# Sign/upload run with always() so evidence exists even on failure.
# This step makes sure a failed gate still fails the job.
- name: Enforce gate outcome
if: always()
run: |
if [ "${{ steps.gate.outcome }}" != "success" ]; then
echo "Policy gate did not pass (outcome: ${{ steps.gate.outcome }}). Blocking."
exit 1
fi
echo "Policy gate passed."
Loading