Skip to content

Commit

Permalink
Add input to configure the yarn command via npm_client (#196)
Browse files Browse the repository at this point in the history
* Add input to configure the yarn command

* Update README.md

* Use input parameter

* Rename to `npm_client`

* update descriptions
  • Loading branch information
jtpio authored May 25, 2023
1 parent bcd7e06 commit 043b876
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions .github/actions/update-snapshots/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
required: true

# Optional inputs
npm_client:
description: The command to execute the scripts (yarn, npm, jlpm)
required: false
default: yarn
server_url:
description: The server URL to wait for (see https://github.com/iFaxity/wait-on-action `resource`)
required: false
Expand Down Expand Up @@ -48,11 +52,11 @@ inputs:
required: false
default: github-actions[bot]@users.noreply.github.com
start_server_script:
description: The yarn script to execute to start the server; set it to `null` if Playwright is handling it.
description: The script to execute to start the server; set it to `null` if Playwright is handling it.
required: false
default: start
update_script:
description: The yarn script to execute to update the snapshots
description: The script to execute to update the snapshots
required: false
default: test:update

Expand All @@ -63,14 +67,14 @@ runs:
if: ${{ inputs.start_server_script != 'null' }}
working-directory: ${{ inputs.test_folder }}
shell: bash -l {0}
run: (yarn run ${{ inputs.start_server_script }} 1>/tmp/snapshots-update-server.log 2>&1) &
run: (${{ inputs.npm_client }} run ${{ inputs.start_server_script }} 1>/tmp/snapshots-update-server.log 2>&1) &

- name: Setup integration tests
shell: bash -l {0}
working-directory: ${{ inputs.test_folder }}
run: |
yarn install
yarn run playwright install ${{ inputs.chromium }}
${{ inputs.npm_client }} install
${{ inputs.npm_client }} run playwright install ${{ inputs.chromium }}
- name: Wait for the server
if: ${{ inputs.start_server_script != 'null' }}
Expand All @@ -84,7 +88,7 @@ runs:
continue-on-error: ${{ inputs.continue_on_error == 'yes' }}
shell: bash -l {0}
working-directory: ${{ inputs.test_folder }}
run: yarn run ${{ inputs.update_script }}
run: ${{ inputs.npm_client }} run ${{ inputs.update_script }}

- name: Compress snapshots
if: ${{ runner.os == 'Linux' }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ The requirements and constrains are:

- You must be on the branch to which the snapshots will be committed
- You must installed your project before calling the action
- The action is using `yarn` package manager
- The action is using `yarn` package manager by default but can be configured with `npm_client`
- The Playwright tests must be in TypeScript or JavaScript

An example of workflow that get triggered when a PR comment contains
Expand Down

0 comments on commit 043b876

Please sign in to comment.