feat(runner): enable gitCommitInfo by default on GH Actions (#34743)

This commit is contained in:
Simon Knott 2025-02-12 14:51:00 +01:00 committed by GitHub
parent 3e976e9f10
commit b7785e1662
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 1 deletions

View file

@ -334,6 +334,8 @@ Whether to populate `'git.commit.info'` field of the [`property: TestConfig.meta
This information will appear in the HTML and JSON reports and is available in the Reporter API. This information will appear in the HTML and JSON reports and is available in the Reporter API.
On Github Actions, this feature is enabled by default.
**Usage** **Usage**
```js title="playwright.config.ts" ```js title="playwright.config.ts"

View file

@ -78,7 +78,7 @@ export class FullConfigInternal {
const privateConfiguration = (userConfig as any)['@playwright/test']; const privateConfiguration = (userConfig as any)['@playwright/test'];
this.plugins = (privateConfiguration?.plugins || []).map((p: any) => ({ factory: p })); this.plugins = (privateConfiguration?.plugins || []).map((p: any) => ({ factory: p }));
this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig); this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig);
this.populateGitInfo = takeFirst(userConfig.populateGitInfo, false); this.populateGitInfo = takeFirst(userConfig.populateGitInfo, defaultPopulateGitInfo);
this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map(s => resolveScript(s, configDir)).filter(script => script !== undefined); this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map(s => resolveScript(s, configDir)).filter(script => script !== undefined);
this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map(s => resolveScript(s, configDir)).filter(script => script !== undefined); this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map(s => resolveScript(s, configDir)).filter(script => script !== undefined);
@ -301,6 +301,7 @@ function resolveScript(id: string | undefined, rootDir: string): string | undefi
export const defaultGrep = /.*/; export const defaultGrep = /.*/;
export const defaultReporter = process.env.CI ? 'dot' : 'list'; export const defaultReporter = process.env.CI ? 'dot' : 'list';
const defaultPopulateGitInfo = process.env.GITHUB_ACTIONS === 'true';
const configInternalSymbol = Symbol('configInternalSymbol'); const configInternalSymbol = Symbol('configInternalSymbol');

View file

@ -1367,6 +1367,8 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
* *
* This information will appear in the HTML and JSON reports and is available in the Reporter API. * This information will appear in the HTML and JSON reports and is available in the Reporter API.
* *
* On Github Actions, this feature is enabled by default.
*
* **Usage** * **Usage**
* *
* ```js * ```js

View file

@ -222,6 +222,7 @@ export function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
CI_COMMIT_SHA: undefined, CI_COMMIT_SHA: undefined,
CI_JOB_URL: undefined, CI_JOB_URL: undefined,
CI_PROJECT_URL: undefined, CI_PROJECT_URL: undefined,
GITHUB_ACTIONS: undefined,
GITHUB_REPOSITORY: undefined, GITHUB_REPOSITORY: undefined,
GITHUB_RUN_ID: undefined, GITHUB_RUN_ID: undefined,
GITHUB_SERVER_URL: undefined, GITHUB_SERVER_URL: undefined,