Skip to content

Commit 7de82fe

Browse files
committed
updates
1 parent 4d2f157 commit 7de82fe

File tree

9 files changed

+2971
-2976
lines changed

9 files changed

+2971
-2976
lines changed

.github/workflows/setup-stackql.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,19 @@ jobs:
3535
3636
- name: Use GitHub Provider
3737
run: |
38-
stackql exec -i ./examples/github-example.iql --auth='{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }'
38+
stackql exec -i ./examples/github-example.iql
3939
env:
40-
STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}
41-
42-
- name: Prep Google Creds (Windows)
43-
if: ${{ matrix.os == 'windows-latest'}}
44-
run: | ## use the secret to create json file
45-
$GoogleCreds = [System.Environment]::GetEnvironmentVariable("GOOGLE_CREDS_ENV")
46-
$GoogleCredsDecoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($GoogleCreds))
47-
Write-Output $GoogleCredsDecoded | Set-Content sa-key.json
48-
shell: pwsh
49-
env:
50-
GOOGLE_CREDS_ENV: ${{ secrets.GOOGLE_CREDS }}
40+
STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }}
41+
STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }}
5142

52-
- name: Prep Google Creds (bash)
53-
if: ${{ matrix.os != 'windows-latest' }}
54-
run: | ## use the secret to create json file
55-
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
56-
5743
- name: Use Google Provider
5844
run: |
59-
stackql exec -i ./examples/google-example.iql --auth='{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'
45+
stackql exec -i ./examples/google-example.iql
46+
env:
47+
GOOGLE_CREDENTIALS : ${{ secrets.GOOGLE_CREDENTIALS }}
6048

6149
- name: Handle error
6250
if: ${{ matrix.use_wrapper}}
6351
continue-on-error: true
64-
run: | ## use the secret to create json file
65-
stackql exec -i ./examples/github-example.iql --auth="${INVALID_AUTH}"
52+
run: | ## specify a query file that doesnt exist
53+
stackql exec -i ./examples/does-not-exist.iql

README.md

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,47 @@
22

33
# setup-stackql
44

5-
The `stackql/setup-stackql` action is a JavaScript action that sets up StackQL CLI in your GitHub Actions workflow by:
6-
7-
- Downloading a latest Stackql CLI and adding it to the `PATH`.
8-
- Setup AUTH env var in the Github Action
5+
The `stackql/setup-stackql` action is a JavaScript action that sets up StackQL CLI in your GitHub Actions workflow by downloading a latest Stackql CLI and adding it to the `PATH`.
96

107
This action can be run on `ubuntu-latest`, `windows-latest`, and `macos-latest` GitHub Actions runners, and will install and expose the latest version of the `stackql` CLI on the runner environment.
118

12-
# Usage
13-
[Learn more](https://stackql.io/docs/getting-started/authenticating) about authentication setup when running stackql
9+
## Usage
10+
Authentication to StackQL providers is done via environment variables source from GitHub Actions Secrets. To learn more about authentication, see the setup instructions for your provider or providers at the [StackQL Provider Registry Docs](https://stackql.io/registry).
1411

15-
## Basic Example
16-
1. Set Auth variable, for example:
17-
```
18-
{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }
19-
```
20-
2. create the github token as a secret
21-
3. In the execution step, pass the secret as environment variable with name "STACKQL_GITHUB_CREDS"
12+
## Examples
13+
The following example demonstrate the use of the `stackql/setup-stackql` action in a GitHub Actions workflow, demonstrating how to use the action to install the `stackql` CLI and then use it to execute a StackQL query.
2214

23-
Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example
15+
### GitHub Example
16+
Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example, for more information on the GitHub provider for StackQL, see the [GitHub Provider Docs](https://registry.stackql.io/github).
17+
18+
```yaml
19+
- name: setup StackQL
20+
uses: stackql/setup-stackql@v1.2.0
21+
with:
22+
use_wrapper: true
2423

25-
### Example
26-
```
2724
- name: Use GitHub Provider
2825
run: |
29-
stackql exec -i ./examples/github-example.iql --auth='{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }'
26+
stackql exec -i ./examples/github-example.iql
3027
env:
31-
STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}
32-
```
33-
34-
35-
## json File Auth example
36-
37-
1. Set Auth variable, for example:
28+
STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }}
29+
STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }}
3830
```
39-
{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}
40-
```
41-
2. encode the key json file into base64 string
42-
3. in execution step, run `sudo echo ${{ secrets.<name of the secret> }} | base64 -d > sa-key.json`
4331
44-
Check the "Prep Google Creds" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example
32+
### Google Example
33+
Check the "Use Google Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example, for more information on the Google provider for StackQL, see the [Google Provider Docs](https://registry.stackql.io/google).
4534
46-
### Example
47-
```
48-
- name: Prep Google Creds (bash)
49-
if: ${{ matrix.os != 'windows-latest' }}
50-
run: | ## use the secret to create json file
51-
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
35+
```yaml
36+
- name: setup StackQL
37+
uses: stackql/setup-stackql@v1.2.0
38+
with:
39+
use_wrapper: true
5240

5341
- name: Use Google Provider
5442
run: |
55-
stackql exec -i ./examples/google-example.iql --auth='{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'
43+
stackql exec -i ./examples/google-example.iql
44+
env:
45+
GOOGLE_CREDENTIALS : ${{ secrets.GOOGLE_CREDENTIALS }}
5646
```
5747
5848
## Inputs

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 'StackQL Studios - Setup StackQL'
22
description: 'Sets up the StackQL CLI in your GitHub Actions workflow.'
3-
author: 'Yuncheng Yang, Jeffery Aven'
3+
author: 'Yuncheng Yang, Jeffrey Aven'
44
inputs:
55
use_wrapper:
66
description: 'Whether or not to install a wrapper to wrap subsequent calls of the `stackql` binary and expose its STDOUT, STDERR, and exit code as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`.'

0 commit comments

Comments
 (0)