Skip to content

Commit bc5c4ae

Browse files
updated readme
1 parent 732c9db commit bc5c4ae

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,77 @@
11
# stackql-exec
22
Github Action as a wrapper for executing a single command in stackql, maps all stackql exec args to actions args
3+
4+
# Usage
5+
6+
## Basic Example
7+
```
8+
- name: exec github example
9+
uses: ./
10+
with:
11+
auth_str: '{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }'
12+
query: "REGISTRY PULL github v23.01.00104;
13+
SHOW PROVIDERS;
14+
select total_private_repos
15+
from github.orgs.orgs
16+
where org = 'stackql';"
17+
env:
18+
STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}
19+
20+
```
21+
22+
23+
## Auth json file and query file example
24+
- `auth.json`
25+
```
26+
{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" },
27+
"github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" }}
28+
```
29+
- `google-example.iql`
30+
```
31+
REGISTRY PULL github v23.01.00104;
32+
SHOW PROVIDERS;
33+
select total_private_repos
34+
from github.orgs.orgs
35+
where org = 'stackql';
36+
```
37+
**Example**
38+
```
39+
- name: Prep Google Creds (Windows)
40+
if: ${{ matrix.os == 'windows-latest'}}
41+
run: | ## use the secret to create json file
42+
$GoogleCreds = [System.Environment]::GetEnvironmentVariable("GOOGLE_CREDS_ENV")
43+
$GoogleCredsDecoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($GoogleCreds))
44+
Write-Output $GoogleCredsDecoded | Set-Content sa-key.json
45+
shell: pwsh
46+
env:
47+
GOOGLE_CREDS_ENV: ${{ secrets.GOOGLE_CREDS }}
48+
49+
- name: Prep Google Creds (bash)
50+
if: ${{ matrix.os != 'windows-latest' }}
51+
shell: bash
52+
run: | ## use the base64 encoded secret to create json file
53+
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
54+
55+
- name: exec google example
56+
uses: ./
57+
with:
58+
auth_obj_path: './stackql_scripts/auth.json'
59+
query_file_path: './stackql_scripts/google-example.iql'
60+
```
61+
62+
63+
## Input
64+
- `auth_obj_path` - (optional) the path of json file that stores stackql AUTH string
65+
- `auth_str` - (optional) stackql AUTH string, need either auth_str or auth_obj_path
66+
- `query` - (optional) stackql query to execute
67+
- `query_file_path` - (optional) stackql query file to execute, need either query or query_file_path
68+
- `query_output` - (optional) output format of the stackql exec result, accept "table", "csv", "json", default to "json"
69+
70+
71+
## Outputs
72+
This action uses [setup-stackql](https://github.com/marketplace/actions/stackql-studio-setup-stackql), with use_wrapper set
73+
to `true`, the following outputs are available for subsequent steps that call the `stackql` binary:
74+
75+
- `stdout` - The STDOUT stream of the call to the `stackql` binary.
76+
- `stderr` - The STDERR stream of the call to the `stackql` binary.
77+
- `exitcode` - The exit code of the call to the `stackql` binary.

0 commit comments

Comments
 (0)