Skip to content

Commit 21c5604

Browse files
authored
Merge pull request #4 from ekasprzak/ekasprzak-patch-1
Update test-envs.yml
2 parents 682975a + 48056fa commit 21c5604

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/test-envs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,30 @@ on:
1818
type: environment
1919
required: true
2020

21+
envstring:
22+
description: 'env name as a string'
23+
required: true
24+
type: string
25+
2126
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2227
jobs:
28+
validate-env:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: checkout repo
32+
uses: actions/checkout@v4
33+
34+
- name: validate env input
35+
id: validate
36+
run: |
37+
ENV_INPUT="${{ github.event.inputs.envstring }}"
38+
if jq -e --arg env "$ENV_INPUT" 'index($env)' environments.json > /dev/null; then
39+
echo "Environment is valid: $ENV_INPUT"
40+
else
41+
echo "Error: Provided environment '$ENV_INPUT' is not valid. Allowed values are: $(jq -r '.[]' environments.json | paste -sd ',')"
42+
exit 1
43+
fi
44+
2345
# This workflow contains a single job called "build"
2446
build:
2547
# The type of runner that the job will run on

0 commit comments

Comments
 (0)