Skip to content

Commit

Permalink
feat: forward environment and add input options
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhirn committed Oct 2, 2024
1 parent 5f961ef commit 0e350a5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@ jobs:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Setup Playwright
- name: Run Playwright
uses: ./
env:
TEST_ENV: hello from env
with:
options: -e TEST_OPTION='hello from options'
run: |
echo hello
echo world
echo hello world
echo ${TEST_ENV}
echo ${TEST_OPTION}
ubuntu-with-version:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Setup Playwright
- name: Run Playwright
uses: ./
with:
version: v1.47.1
Expand Down
34 changes: 19 additions & 15 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,32 @@ inputs:
description: Commands to execute
required: true
type: string
options:
description: Additional docker arguments
required: false
branding:
icon: play
color: orange
runs:
using: composite
steps:
- name: Setup Playwright script
shell: bash
run: |
mkdir -p .playwright
echo "#!/usr/bin/env bash" > .playwright/run.sh
echo "set -euo pipefail" >> .playwright/run.sh
echo "${{ inputs.run }}" >> .playwright/run.sh
chmod +x .playwright/run.sh
- name: Run Playwright
shell: bash
run: |
set -eux
set -euo pipefail
mkdir -p .run-playwright
echo "#!/usr/bin/env bash" > .run-playwright/run.sh
echo "set -euo pipefail" >> .run-playwright/run.sh
echo '${{ inputs.run }}' >> .run-playwright/run.sh
chmod +x .run-playwright/run.sh
ENV="$(echo '${{ toJson(env) }}' | jq -r 'keys | map("-e \(.)") | join(" ")')"
docker run --rm \
-e CI=true \
--workdir /github/workspace \
-v "${{ github.workspace }}":/github/workspace \
mcr.microsoft.com/playwright:${{ inputs.version }} \
.playwright/run.sh
--workdir /github/workspace \
-v "${{ github.workspace }}":/github/workspace \
-e CI=true ${ENV}
${{ inputs.options }} \
mcr.microsoft.com/playwright:${{ inputs.version }} \
.run-playwright/run.sh

0 comments on commit 0e350a5

Please sign in to comment.