Skip to content

Commit f501307

Browse files
committed
add environment parameter to workflow
1 parent 93fdad2 commit f501307

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

.github/workflows/functional_selected_device.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ on:
44
workflow_dispatch:
55
inputs:
66
device:
7-
description: 'Device to test (exact name - defaults to "Desktop Chrome")'
7+
description: 'Device to test (exact name)'
88
required: false
99
default: 'Desktop Chrome'
10+
environment:
11+
description: 'Environment to run tests on (QA, TEST, TRAINING)'
12+
required: false
13+
default: 'QA'
1014
pull_request:
1115

1216
jobs:
@@ -33,6 +37,22 @@ jobs:
3337
echo "device=${{ github.event.inputs.device }}" >> $GITHUB_OUTPUT
3438
fi
3539
40+
- name: Set environment
41+
id: set-environment
42+
run: |
43+
declare -A env_map=(
44+
[QA]="qa.mavistesting.com"
45+
[TEST]="test.mavistesting.com"
46+
[TRAINING]="training.manage-vaccinations-in-schools.nhs.uk"
47+
)
48+
if [ "${{ github.event_name }}" = "pull_request" ]; then
49+
echo "environment=${env_map[QA]}" >> $GITHUB_OUTPUT
50+
else
51+
input_env="${{ github.event.inputs.environment }}"
52+
url="${env_map[$input_env]:-${env_map[QA]}}"
53+
echo "environment=$url" >> $GITHUB_OUTPUT
54+
fi
55+
3656
- name: Install uv
3757
uses: astral-sh/setup-uv@v6
3858

@@ -47,7 +67,7 @@ jobs:
4767
- name: Run tests
4868
run: uv run pytest --device "${{ steps.set-device.outputs.device }}"
4969
env:
50-
BASE_URL: ${{ vars.BASE_URL }}
70+
BASE_URL: ${{ steps.set-environment.outputs.environment }}
5171
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
5272
BASIC_AUTH_USERNAME: ${{ secrets.BASIC_AUTH_USERNAME }}
5373

0 commit comments

Comments
 (0)