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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Run test suites using Stably's agent (v2) test runner.
| api-key | ✅ | | Your API key |
| project-id | ✅ | | Your Stably project ID |
| playwright-project-name | | | The Playwright project name to run. Maps to the `--project` CLI flag. Optional - if not provided, all projects will run. |
| env-overrides | | | A YAML string or JSON object containing environment variable overrides. Each key is a variable name and the value is a string. |
| github-comment | | true | When enabled, will leave a comment on either the commit or PR with relevant test results. Requires proper permissions (see [Permissions](#permissions) section below). | |
| environment-name | | | Name of the environment to use for this run (e.g. "Staging", "Production"). When omitted, falls back to the project's default environment. |
| env-overrides | | | A YAML string or JSON object containing environment variable overrides. Each key is a variable name and the value is a string. These take precedence over environment variables. |
| github-comment | | true | When enabled, will leave a comment on either the commit or PR with relevant test results. Requires proper permissions (see [Permissions](#permissions) section below). |
| github-token | | `${{ github.token }}` | This token is used for leaving the comments on PRs/commits. By default, we'll use the GitHub actions bot token, but you can override this a repository scoped [PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). |
| async | | false | If set, will launch the tests but not wait for them to finish and the action will always output success. Note: Github comments will not function if this is set |

Expand Down Expand Up @@ -58,7 +59,9 @@ jobs:
project-id: YOUR_PROJECT_ID
# Optional: specify Playwright project(s) to run (instead of all projects)
playwright-project-name: smoke-tests
# Optional: override environment variables
# Optional: select which environment to load variables from
environment-name: Staging
# Optional: override specific environment variables
env-overrides: |
BASE_URL: https://staging.example.com
API_KEY: abc123
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ inputs:
Example:
BASE_URL: https://staging.example.com
API_KEY: abc123
environment-name:
description: |-
Name of the environment to use for this run (v2 only).
For example: "Staging", "Production".
When omitted, falls back to the project's default environment.
test-group-id:
description: The test group ID to execute (v1 only)
deprecationMessage:
Expand Down Expand Up @@ -65,7 +70,8 @@ inputs:
default: 'false'
environment:
description: |-
The environment to inherit variables from (v1 only, v2 support soon).
The environment to inherit variables from (v1 only).
For v2, use environment-name instead.
Defaults to 'PRODUCTION'.
default: 'PRODUCTION'
variable-overrides:
Expand Down
12 changes: 8 additions & 4 deletions dist/index.js

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

5 changes: 4 additions & 1 deletion src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type V2Input = BaseInput & {
projectId: string;
playwrightProjectName: string | undefined;
envOverrides: Record<string, string> | undefined;
environmentName: string | undefined;
};

type V1Input = BaseInput & {
Expand Down Expand Up @@ -61,6 +62,7 @@ export function parseInput(): ParsedInput {
string
>)
: undefined;
const environmentName = getInput('environment-name').trim() || undefined;

// V1 inputs (supporting deprecating of runGroupIds)
const testSuiteIdInput = getInput('test-suite-id');
Expand Down Expand Up @@ -137,7 +139,8 @@ export function parseInput(): ParsedInput {
version: 'v2' as const,
projectId,
playwrightProjectName: playwrightProjectName || undefined,
envOverrides
envOverrides,
environmentName
}
: {
version: 'v1' as const,
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ async function runV2({
githubComment,
githubToken,
runInAsyncMode,
envOverrides
envOverrides,
environmentName
}: V2Input): Promise<void> {
const { runId } = await startPlaywrightRun({
projectId,
apiKey,
options: {
playwrightProjectName,
envOverrides
envOverrides,
environmentName
}
});
setOutput('testSuiteRunId', runId);
Expand Down
4 changes: 3 additions & 1 deletion src/stably/api/playwright-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export async function startPlaywrightRun({
options: {
playwrightProjectName?: string;
envOverrides?: Record<string, string>;
environmentName?: string;
};
}): Promise<PlaywrightRunResponse> {
const httpClient = new HttpClient('github-action', [
Expand All @@ -77,7 +78,8 @@ export async function startPlaywrightRun({

const body = {
playwrightProjectName: options.playwrightProjectName,
envOverrides: options.envOverrides
envOverrides: options.envOverrides,
environmentName: options.environmentName
};

const runUrl = new URL(`/v1/projects/${projectId}/runs`, API_ENDPOINT).href;
Expand Down
Loading