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
15 changes: 8 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ The backend filters slugs with PostgreSQL's `~*` operator (case-insensitive POSI

## Action inputs/outputs

| Input | Required | Default |
| ------------- | -------- | ------------------------ |
| `api-token` | Yes | |
| `team` | No | |
| `feature` | No | |
| `test-case` | No | |
| `backend-url` | No | https://backend.heal.dev |
| Input | Required | Default |
| ---------------- | -------- | ------------------------ |
| `api-token` | Yes | |
| `team` | No | |
| `feature` | No | |
| `test-case` | No | |
| `entrypoint-url` | No | |
| `backend-url` | No | https://backend.heal.dev |

| Output | Description |
| ------ | ---------------------------------------- |
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,24 @@ Filters accept exact slugs or glob patterns (`*` matches any sequence of charact
api-token: ${{ secrets.HEAL_API_TOKEN }}
team: finance
test-case: '*login*'

# Override the application entry point URL
- uses: heal-dev/heal-trigger@v1
with:
api-token: ${{ secrets.HEAL_API_TOKEN }}
entrypoint-url: https://staging.myapp.com
```

## Inputs

| Input | Description | Required | Default |
| ------------- | ----------------------------------------------------------------- | -------- | -------------------------- |
| `api-token` | Your Heal API token | Yes | |
| `team` | Filter by team slug. Supports glob patterns (e.g. `*nance`) | No | |
| `feature` | Filter by feature slug. Supports glob patterns | No | |
| `test-case` | Filter by test case slug. Supports glob patterns (e.g. `*login*`) | No | |
| `backend-url` | Override the Heal backend base URL | No | `https://backend.heal.dev` |
| Input | Description | Required | Default |
| ---------------- | ----------------------------------------------------------------- | -------- | -------------------------- |
| `api-token` | Your Heal API token | Yes | |
| `team` | Filter by team slug. Supports glob patterns (e.g. `*nance`) | No | |
| `feature` | Filter by feature slug. Supports glob patterns | No | |
| `test-case` | Filter by test case slug. Supports glob patterns (e.g. `*login*`) | No | |
| `entrypoint-url` | Override the application entry point URL | No | |
| `backend-url` | Override the Heal backend base URL | No | `https://backend.heal.dev` |

## Outputs

Expand Down
30 changes: 30 additions & 0 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,36 @@ describe('run', () => {
expect(new RegExp(body.testCaseSlugRegex, 'i').test('logout')).toBe(false);
});

it('sends entrypointUrl as-is when entrypoint-url is provided', async () => {
const core = await import('@actions/core');
vi.mocked(core.getInput).mockImplementation((name: string) => {
if (name === 'api-token') return 'test-token';
if (name === 'entrypoint-url') return 'https://staging.myapp.com';
return '';
});

await import('../src/index');

const body = JSON.parse(vi.mocked(fetch).mock.calls[0][1]!.body as string);
expect(body.entrypointUrl).toBe('https://staging.myapp.com');
});

it('sends entrypointUrl alongside filters when both are provided', async () => {
const core = await import('@actions/core');
vi.mocked(core.getInput).mockImplementation((name: string) => {
if (name === 'api-token') return 'test-token';
if (name === 'team') return 'finance';
if (name === 'entrypoint-url') return 'https://staging.myapp.com';
return '';
});

await import('../src/index');

const body = JSON.parse(vi.mocked(fetch).mock.calls[0][1]!.body as string);
expect(body.entrypointUrl).toBe('https://staging.myapp.com');
expect(new RegExp(body.teamSlugRegex, 'i').test('finance')).toBe(true);
});

it('uses a custom backend-url when provided', async () => {
const core = await import('@actions/core');
vi.mocked(core.getInput).mockImplementation((name: string) => {
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ inputs:
test-case:
description: Filter by test case slug. Supports glob patterns (e.g. "*login*").
required: false
entrypoint-url:
description: Override the application entry point URL for the triggered execution.
required: false
backend-url:
description: Override the Heal backend base URL.
required: false
Expand Down
3 changes: 3 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25691,13 +25691,16 @@ async function run() {
const team = core.getInput('team');
const feature = core.getInput('feature');
const testCase = core.getInput('test-case');
const entrypointUrl = core.getInput('entrypoint-url');
const body = {};
if (team)
body.teamSlugRegex = (0, utils_1.globToRegex)(team);
if (feature)
body.featureSlugRegex = (0, utils_1.globToRegex)(feature);
if (testCase)
body.testCaseSlugRegex = (0, utils_1.globToRegex)(testCase);
if (entrypointUrl)
body.entrypointUrl = entrypointUrl;
const response = await fetch(`${backendUrl}/api/v1/executions/trigger`, {
method: 'POST',
headers: {
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ async function run(): Promise<void> {
const team = core.getInput('team');
const feature = core.getInput('feature');
const testCase = core.getInput('test-case');
const entrypointUrl = core.getInput('entrypoint-url');

const body: TriggerExecutionRequest = {};
if (team) body.teamSlugRegex = globToRegex(team);
if (feature) body.featureSlugRegex = globToRegex(feature);
if (testCase) body.testCaseSlugRegex = globToRegex(testCase);
if (entrypointUrl) body.entrypointUrl = entrypointUrl;

const response = await fetch(`${backendUrl}/api/v1/executions/trigger`, {
method: 'POST',
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface TriggerExecutionRequest {
teamSlugRegex?: string;
featureSlugRegex?: string;
testCaseSlugRegex?: string;
entrypointUrl?: string;
}

export interface ExternalExecutionTriggeredResponse {
Expand Down