Skip to content

Commit ec93779

Browse files
authored
Fix query (#9)
1 parent e5d2bfd commit ec93779

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

.github/workflows/test-query-3.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Test query three
2+
on:
3+
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
4+
# #
5+
# # Added pull_request to register workflow from the PR.
6+
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
7+
# pull_request: {}
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
setup:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setup
15+
run: echo "Do setup"
16+
17+
test:
18+
runs-on: ubuntu-latest
19+
continue-on-error: true
20+
needs: [setup]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- uses: ./
26+
id: current
27+
with:
28+
query: .false
29+
config: |
30+
true:
31+
mask: ". + {}"
32+
false:
33+
mask: "{\"one\": . + {}}"
34+
outputs:
35+
mask: "${{ steps.current.outputs.mask }}"
36+
37+
assert:
38+
runs-on: ubuntu-latest
39+
needs: [test]
40+
steps:
41+
- uses: nick-fields/assert-action@v1
42+
with:
43+
expected: '{"one": . + {}}'
44+
actual: "${{ needs.test.outputs.mask }}"
45+
46+
47+
teardown:
48+
runs-on: ubuntu-latest
49+
needs: [assert]
50+
if: ${{ always() }}
51+
steps:
52+
- name: Tear down
53+
run: echo "Do Tear down"

entrypoint.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
set -e
44
set -o pipefail
55

6+
oIFS="$IFS"
7+
IFS=$'\n'
68
OUTPUTS=(
79
$(
810
echo "${CONFIG}" | \
9-
yq -o json -M -e | \
10-
jq -c -e -M "${QUERY} | to_entries | map(\"\(.key)=\(.value|tostring)\")|.[]" | \
11+
yq -o json -M -e | \
12+
jq -c -e -M "${QUERY} | to_entries | map(\"\(.key)=\(.value|tostring)\")|.[]" | \
1113
sed -e 's/^"//' -e 's/"$//'
1214
)
1315
)
16+
IFS="$oIFS"
17+
18+
echo "${OUTPUTS}"
1419

1520
## There is a bug with multiline output
1621
## Read this thread https://github.com/orgs/community/discussions/26288

0 commit comments

Comments
 (0)