Skip to content

Conversation

karlhorky
Copy link
Contributor

The container image version can be kept up to date with the Playwright version in package.json with configuring a previous GitHub Actions job, as documented in the following resources:

Alternatives Considered

  1. This could be an addition to the existing "Via Containers" section, with examples for all languages Node.js, Python, Java, .NET
  2. This new workflow could become the default suggested "Via Containers" workflow for GitHub Actions
  3. A separate GitHub Actions workflow to edit the versions in the workflow files and commit to Git (downsides: more PR noise and greater required GitHub permissions)

- name: resolve-playwright-version
id: resolve-playwright-version
run: |
version="$(yq -r '.devDependencies["@playwright/test"] // ""' package.json)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should read it from the lockfile instead - because ^1.30 could also end up in v1.55.0 - wdyt?

Copy link
Contributor Author

@karlhorky karlhorky Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I considered that: downside would be complexity - since there are a lot of people not on npm, should be provided for every lockfile format (npm-lock.json, yarn.lock, pnpm-lock.yaml, bun.lock).

I was also looking into possible CLI commands (eg. npm, yarn, pnpm, bun commands) or trusted npm packages which would make this simple, but I didn't see something simple and unified in half an hour of research.

That's why I ended up with the extra text in the paragraph:

if you install an exact version of Playwright, then it can be retrieved from package.json

But exact versions are pretty uncommon in package.json files, so maybe worth doing something about it.


If it's worth it, I could try writing some commands / a small script in this direction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another (more expensive) alternative would be to install using whatever package manager (minimal command branching here) and then retrieve the version from node_modules/@playwright/test/package.json. But this wouldn't work for package managers which don't use node_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants