From a997ba6e22173e6434b5dab29c3b2eb35d87298f Mon Sep 17 00:00:00 2001 From: Vladimir Date: Sun, 1 Nov 2026 22:15:17 +0500 Subject: [PATCH] test: update hosted Guard workflow to 0.13.2 --- .github/workflows/codapult-guard.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codapult-guard.yml b/.github/workflows/codapult-guard.yml index ca1a56fcb..369b1d515 100644 --- a/.github/workflows/codapult-guard.yml +++ b/.github/workflows/codapult-guard.yml @@ -117,8 +117,7 @@ jobs: ;; esac else - # This repository is a Guard integration fixture. Keep push runs - # focused on Guard; upstream project checks are covered separately. + # Keep this hosted fixture's push run focused on Guard itself. check_args=(--no-project-checks --tools off) fi if [ -n "$POLICY_BASE" ]; then @@ -134,15 +133,23 @@ jobs: GUARD_POLICY_MODE: ${{ vars.CODAPULT_GUARD_POLICY_MODE || 'host-review' }} run: | node --input-type=module <<'NODE' - import { appendFileSync, existsSync, readFileSync, statSync } from 'node:fs'; + import { appendFileSync, readFileSync } from 'node:fs'; const resultFile = process.env.GUARD_RESULT_FILE; - if (!resultFile || !existsSync(resultFile) || statSync(resultFile).size === 0) { + let resultContent; + try { + if (!resultFile) throw new Error('missing result file path'); + resultContent = readFileSync(resultFile, 'utf8'); + } catch { + appendFileSync(process.env.GITHUB_STEP_SUMMARY, '## Codapult Guard\n\n- Result: **incomplete** (verification did not produce a result file).\n'); + process.exit(0); + } + if (resultContent.length === 0) { appendFileSync(process.env.GITHUB_STEP_SUMMARY, '## Codapult Guard\n\n- Result: **incomplete** (verification did not produce a result file).\n'); process.exit(0); } let result; try { - result = JSON.parse(readFileSync(resultFile, 'utf8')); + result = JSON.parse(resultContent); } catch { appendFileSync(process.env.GITHUB_STEP_SUMMARY, '## Codapult Guard\n\n- Result: **incomplete** (verification result was not valid JSON).\n'); process.exit(0); @@ -245,12 +252,12 @@ jobs: GUARD_STATEMENT_FILE: ${{ runner.temp }}/guard-verification.intoto.json run: | node --input-type=module <<'NODE' - import { existsSync, readFileSync, rmSync } from 'node:fs'; + import { readFileSync, rmSync } from 'node:fs'; const statementFile = process.env.GUARD_STATEMENT_FILE; const resultFile = process.env.GUARD_RESULT_FILE; let result; try { - if (!resultFile || !existsSync(resultFile)) throw new Error('missing result'); + if (!resultFile) throw new Error('missing result path'); result = JSON.parse(readFileSync(resultFile, 'utf8')); } catch { if (statementFile) rmSync(statementFile, { force: true }); @@ -275,7 +282,7 @@ jobs: - name: Upload verification receipt if: always() - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: codapult-guard-verification path: | @@ -310,7 +317,7 @@ jobs: - name: Upload PR review packet if: always() && github.event_name == 'pull_request' - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: codapult-guard-review path: ${{ runner.temp }}/guard-review.json