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

@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.

Another (more expensive) alternative would be to install Playwright from the package.json + lockfile using the detected package manager (minimal command branching here) and either:

  1. Retrieve the version using npm list, yarn list, pnpm list, etc
  2. Retrieve the version from node_modules/@playwright/test/package.json (downside: this wouldn't work for package managers which don't use node_modules)

Copy link

Choose a reason for hiding this comment

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

For me this doesn't work, because I have a ^ in my package.json

  Warning: Docker pull failed with exit code 1, back off 5.126 seconds before retry.
  /usr/bin/docker pull mcr.microsoft.com/playwright:v^1.56.0-noble
  invalid reference format

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's the situation that I described above:

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

So probably worth it to either:

  1. Write some commands / a small script to read the version from all common lockfile formats
  2. Install @playwright/test using package manager + retrieve version using package manager commands like npm list

@mxschmitt what do you think?

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.

3 participants