From 7797e12dde68aad4c9a6f386157746bff616ef22 Mon Sep 17 00:00:00 2001 From: Pierre Oucif Date: Mon, 2 Mar 2026 15:40:42 +0100 Subject: [PATCH] Add entrypointUrl --- CLAUDE.md | 15 ++++++++------- README.md | 21 ++++++++++++++------- __tests__/index.test.ts | 30 ++++++++++++++++++++++++++++++ action.yml | 3 +++ dist/index.js | 3 +++ src/index.ts | 2 ++ src/types.ts | 1 + 7 files changed, 61 insertions(+), 14 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 4700c25..d133645 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 | | ------ | ---------------------------------------- | diff --git a/README.md b/README.md index ab3c07b..4b4c6d8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 221ee14..a962ef4 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -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) => { diff --git a/action.yml b/action.yml index b8a6c11..4f37aaa 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/dist/index.js b/dist/index.js index 58f776c..aea0da2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -25691,6 +25691,7 @@ 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); @@ -25698,6 +25699,8 @@ async function run() { 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: { diff --git a/src/index.ts b/src/index.ts index 56f396a..e6d611a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,11 +9,13 @@ async function run(): Promise { 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', diff --git a/src/types.ts b/src/types.ts index 7b491ff..161eb68 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2,6 +2,7 @@ export interface TriggerExecutionRequest { teamSlugRegex?: string; featureSlugRegex?: string; testCaseSlugRegex?: string; + entrypointUrl?: string; } export interface ExternalExecutionTriggeredResponse {