Skip to content

Commit ee24c44

Browse files
Merge pull request #8 from stackql/feat/set-action-output
- fix the output using composite action outputs - added a validation step
2 parents 691b168 + 0abde52 commit ee24c44

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

.github/workflows/stackql-exec.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ jobs:
3434
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
3535
3636
- name: exec google example with query file
37-
id: exec-stackql-file
37+
id: stackql-exec-file
3838
uses: ./
3939
with:
4040
auth_obj_path: './stackql_scripts/auth.json'
4141
query_file_path: './stackql_scripts/google-example.iql'
4242

4343
- name: exec github example with query string
44-
id: exec-stackql-string
44+
id: stackql-exec-string
4545
uses: ./
4646
with:
4747
auth_str: '{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }'
@@ -53,4 +53,16 @@ jobs:
5353
env:
5454
STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}
5555

56+
- name: validate stackql-exec output
57+
shell: bash
58+
run: |
59+
if [ -z '${{ steps.stackql-exec-file.outputs.exec-result }}' ]; then
60+
echo "exec-stackql output does not contain expected result"
61+
exit 1
62+
fi
63+
if [ -z '${{ steps.stackql-exec-string.outputs.exec-result }}' ]; then
64+
echo "exec-stackql output does not contain expected result"
65+
exit 1
66+
fi
67+
5668

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ where org = 'stackql';
8686

8787
## Outputs
8888
This action uses [setup-stackql](https://github.com/marketplace/actions/stackql-studio-setup-stackql), with use_wrapper set
89-
to `true`, the following outputs are available for subsequent steps that call the `stackql` binary:
89+
to `true`, `stdout` and `stderr` are set to `exec-result` and `exec-error`
9090

91-
- `stdout` - The STDOUT stream of the call to the `stackql` binary.
92-
- `stderr` - The STDERR stream of the call to the `stackql` binary.
93-
- `exitcode` - The exit code of the call to the `stackql` binary.
91+
- `exec-result` - The STDOUT stream of the call to the `stackql` binary.
92+
- `exec-error` - The STDERR stream of the call to the `stackql` binary.

action.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ inputs:
1818
description: output format
1919
default: 'json'
2020
required: false
21+
outputs:
22+
exec-result:
23+
description: "stdout of stackql command"
24+
value: ${{ steps.exec-stackql.outputs.stdout }}
25+
exec-error:
26+
description: "stderr of stackql command"
27+
value: ${{ steps.exec-stackql.outputs.stderr }}
2128

2229
runs:
2330
using: "composite"
@@ -70,16 +77,6 @@ runs:
7077
shell: bash
7178
run: |
7279
${{ env.STACKQL_COMMAND }}
73-
74-
- name: validate exec-stackql output
75-
shell: bash
76-
run: |
77-
echo "exec-stackql output: ${{ steps.exec-stackql.outputs.stdout }}"
78-
if [ -z ${{ steps.exec-stackql.outputs.stdout }} ]; then
79-
echo "exec-stackql output does not contain expected result"
80-
exit 1
81-
fi
82-
8380
8481
branding:
8582
icon: 'terminal'

lib/tests/utils.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { setupAuth, getStackqlCommand } = require("../utils");
1+
const { setupAuth, getStackqlCommand, setOutput } = require("../utils");
22

33
describe("util", () => {
44
let core;

0 commit comments

Comments
 (0)