Skip to content
Closed
Show file tree
Hide file tree
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
22 changes: 15 additions & 7 deletions .github/workflows/codapult-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,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);
Expand Down Expand Up @@ -245,12 +253,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 });
Expand All @@ -275,7 +283,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: |
Expand Down Expand Up @@ -310,7 +318,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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@changesets/changelog-github": "workspace:*",
"@changesets/cli": "workspace:*",
"@codapult/guard": "0.13.0",
"@codapult/guard": "0.13.2",
"@e18e/eslint-plugin": "^0.8.0",
"@eslint/js": "10.0.1",
"@manypkg/cli": "^0.25.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dedupePeerDependents: true
minimumReleaseAge: 10080
minimumReleaseAgeExclude:
- "@codapult/guard@0.12.0"
- "@codapult/guard@0.13.2"
- "@codapult/guard@0.13.0"
- "@codapult/guard@0.11.0"
- "@pnpm/exe.android-arm64@12.4.1"
Expand Down
Loading