Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
91 lines (84 loc) · 2.78 KB
/
Copy pathaction.yml
File metadata and controls
91 lines (84 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: 'StackQL Studios - StackQL Exec'
description: 'A wrapper for executing a single command, maps all stackql exec args to actions args (supplied using with.)'
author: 'Yuncheng Yang, StackQL Studios'
inputs:
query:
description: stackql query to be executed
required: false
query_file_path:
description: stackql query file to be executed
required: false
vars:
description: comma delimited list of vars to be passed to query preprocessor (jsonnet)
required: false
query_output:
description: output format
default: 'json'
required: false
auth_obj_path:
description: file path to json object of stackql auth, not required if using standard provider authentication environment variables
required: false
auth_str:
description: json string of stackql auth, not required if using standard provider authentication environment variables
required: false
outputs:
exec-result:
description: "stdout of stackql command"
value: ${{ steps.exec-stackql.outputs.stdout }}
exec-error:
description: "stderr of stackql command"
value: ${{ steps.exec-stackql.outputs.stderr }}
runs:
using: "composite"
steps:
- name: Check StackQL is installed and set output
id: check-stackql
shell: bash
run: |
if command -v stackql &> /dev/null; then
echo "stackql_installed=true" >> $GITHUB_OUTPUT
else
echo "stackql_installed=false" >> $GITHUB_OUTPUT
fi
- name: Setup StackQL
uses: stackql/setup-stackql@v1.2.0
if: ${{steps.check-stackql.outputs.stackql_installed == 'false'}}
with:
use_wrapper: true
- name: Validate Stackql Version
shell: bash
run: |
stackql --version
- name: Setup auth
id: setup-auth
uses: actions/github-script@v6
with:
script: |
const path = require('path');
const utilsPath = path.join(process.env.GITHUB_ACTION_PATH, 'lib', 'utils.js')
const {setupAuth} = require(utilsPath)
setupAuth(core)
env:
AUTH_FILE_PATH: ${{ inputs.auth_obj_path }}
AUTH_STR: ${{inputs.auth_str}}
- name: get stackql command
uses: actions/github-script@v6
with:
script: |
const path = require('path');
const utilsPath = path.join(process.env.GITHUB_ACTION_PATH, 'lib', 'utils.js')
const {getStackqlCommand} = require(utilsPath)
getStackqlCommand(core)
env:
QUERY_FILE_PATH: ${{ inputs.query_file_path }}
QUERY: ${{inputs.query}}
OUTPUT: ${{inputs.query_output}}
VARS: ${{inputs.vars}}
- name: execute stackql command
id: exec-stackql
shell: bash
run: |
${{ env.STACKQL_COMMAND }}
branding:
icon: 'terminal'
color: 'green'