Skip to content
Merged
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
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ runs:
id: check
shell: bash
run: |
set -o pipefail
report_file="$RUNNER_TEMP/context-drift-report.${{ inputs.format }}"
node "$GITHUB_ACTION_PATH/dist/index.js" check \
--base "${{ inputs.base-ref }}" \
Expand Down
5 changes: 5 additions & 0 deletions openspec/specs/github-action/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ The repository SHALL include `action.yml` defining a composite action that insta
- **WHEN** the action is invoked in a workflow with a checked-out repository
- **THEN** it SHALL run the CLI from the action path against `github.workspace`

#### Scenario: CLI failures fail the action step

- **WHEN** the CLI exits with a non-zero status while writing the report through `tee`
- **THEN** the action step SHALL fail with the CLI status

### Requirement: Support action inputs

The action SHALL expose inputs for base ref, minimum confidence, and output format.
Expand Down
15 changes: 15 additions & 0 deletions tests/action.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fs from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";

describe("GitHub Action", () => {
it("preserves the CLI exit code when tee writes the report", async () => {
const action = await fs.readFile(path.join(process.cwd(), "action.yml"), "utf8");
const pipefailIndex = action.indexOf("set -o pipefail");
const teePipelineIndex = action.indexOf('| tee "$report_file"');

expect(pipefailIndex).toBeGreaterThanOrEqual(0);
expect(teePipelineIndex).toBeGreaterThanOrEqual(0);
expect(pipefailIndex).toBeLessThan(teePipelineIndex);
});
});
Loading