Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
terminal

GitHub Action

StackQL Studios - Setup StackQL

v1.1.0

StackQL Studios - Setup StackQL

terminal

StackQL Studios - Setup StackQL

Sets up the StackQL CLI in your GitHub Actions workflow

Installation

Copy and paste the following snippet into your .yml file.

              

- name: StackQL Studios - Setup StackQL

uses: stackql/setup-stackql@v1.1.0

Learn more about this action in stackql/setup-stackql

Choose a version

Setup StackQL

setup-stackql

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.
  • Setup AUTH env var in the Github Action

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.

Usage

Learn more about authentication setup when running stackql

Basic Example

  1. Set Auth variable, for example:
{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }
  1. create the github token as a secret
  2. In the execution step, pass the secret as environment variable with name "STACKQL_GITHUB_CREDS"

Check the "Use GitHub Provider" step in setup-stackql.yml for the working example

Example

    - name: Use GitHub Provider
      run: |
        stackql exec -i ./examples/github-example.iql --auth='{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }'
      env: 
        STACKQL_GITHUB_CREDS: ${{  secrets.STACKQL_GITHUB_CREDS }}

json File Auth example

  1. Set Auth variable, for example:
{ "google": { "type": "service_account",  "credentialsfilepath": "sa-key.json" }}
  1. encode the key json file into base64 string
  2. in execution step, run sudo echo ${{ secrets.<name of the secret> }} | base64 -d > sa-key.json

Check the "Prep Google Creds" step in setup-stackql.yml for the working example

Example

  - name: Prep Google Creds (bash)
      if: ${{ matrix.os != 'windows-latest' }}
      run: | ## use the secret to create json file
        sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json

    - name: Use Google Provider
      run: | 
        stackql exec -i ./examples/google-example.iql --auth='{ "google": { "type": "service_account",  "credentialsfilepath": "sa-key.json" }}'

Inputs

  • use_wrapper - (optional) Whether 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 false.

Outputs

This action does not configure any outputs directly. However, when you set the use_wrapper input to true, the following outputs are available for subsequent steps that call the stackql binary:

  • stdout - The STDOUT stream of the call to the stackql binary.
  • stderr - The STDERR stream of the call to the stackql binary.
  • exitcode - The exit code of the call to the stackql binary.