Skip to content

Commit 3832036

Browse files
committed
added assertions, fixed script a bit
1 parent e913a4d commit 3832036

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,31 @@ jobs:
55
case-basic:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: ./
8+
- name: checkout
9+
uses: actions/checkout@v4
10+
11+
- name: execute
12+
uses: ./
13+
id: execute
914
with:
10-
path: ./tests
15+
working-directory: ./tests/basic/
1116
values: |
1217
values.yml
1318
values-override.yml
1419
output: |
1520
app_name = .appName
1621
host = .nginx.host
22+
23+
- name: validate result (app_name)
24+
uses: nick-fields/assert-action@v2
25+
continue-on-error: true
26+
with:
27+
expected: default
28+
actual: ${{ steps.execute.outputs.app_name }}
29+
30+
- name: validate result (host)
31+
uses: nick-fields/assert-action@v2
32+
continue-on-error: true
33+
with:
34+
expected: ton.org
35+
actual: ${{ steps.execute.outputs.host }}

action.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ description:
55
Because of dynamic nature of output variables, they are written to $GITHUB_OUTPUT.
66
So no output is defined in this action
77
inputs:
8-
path:
8+
working-directory:
99
description: Base directory for values files
1010
required: false
11-
default: '.'
1211
values:
1312
description: List of values files, separated by newline
1413
required: true
@@ -30,11 +29,13 @@ runs:
3029
- name: Extract Helm values
3130
id: extract
3231
shell: bash
32+
working-directory: ${{ inputs.working-directory }}
3333
run: |
3434
EXPRS=()
3535
while IFS= read -r line; do
3636
[[ -z "$line" ]] && continue
3737
EXPRS+=("$line")
3838
done <<< "${{ inputs.output }}"
3939
40-
${{ github.action_path }}/read-values.bash <<< "${{ inputs.values_files }}" >> "$GITHUB_OUTPUT"
40+
${{ github.action_path }}/read-values.bash $EXPRS <<< "${{ inputs.values }}" >> "$GITHUB_OUTPUT"
41+

read-values.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ for out in "$@"; do
2828

2929
IFS='=' read -r KEY EXPR <<< "$out"
3030

31-
# trim surronding whitespace
31+
# trim surrounding whitespace
3232
KEY="${KEY##+([[:space:]])}"
3333
KEY="${KEY%%+([[:space:]])}"
3434
EXPR="${EXPR##+([[:space:]])}"

0 commit comments

Comments
 (0)