snowflakedb/snowflake-cli-action
snowflakedb/snowflake-cli-action has 56 GitHub stars and 19 forks. Star changes are not measured yet. Last checked 2026-11-14 12:54 UTC. Last push 2026-10-22.
实测星标增长
- 24小时
- 正在收集历史
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
关于
Github Action enabling easy use of Snowflake CLI in your CI/CD workflows
数据README.md
原文Snowflake CLI Github Actions
[!IMPORTANT] This action has moved to
snowflakedb/snowflake-actions. To migrate, update youruses:line. The inputs are identical and no other changes are needed:- - uses: snowflakedb/snowflake-cli-action@v2 + - uses: snowflakedb/snowflake-actions@v3
Usage
Snowflake CLI Github Actions streamline installing and using Snowflake CLI in your CI/CD workflows. The CLI is installed in
isolated way, making sure it won't conflict with dependencies of your project. It automatically sets up
the input configuration file within the ~/.snowflake/ directory.
The action enables automation of your Snowflake CLI tasks, such as deploying Native Apps or running Snowpark scripts within your Snowflake environment.
Inputs
cli-version
The specified Snowflake CLI version, for example 3.6.0. If not provided, the latest version of the Snowflake CLI is used.
custom-github-ref
The branch, tag, or commit to install from if you want to install the CLI directly from GitHub.
Note:
cli-versionandcustom-github-refcannot be used together. Please specify only one of these arguments at a time.
use-oidc
Boolean flag to enable OIDC authentication. When set to true, the action will configure the CLI to use GitHub's OIDC token for authentication with Snowflake, eliminating the need for storing private keys as secrets. Default is false.
default-config-file-path
Path to the configuration file (config.toml) in your repository. The path must be relative to root of repository. The configuration file is not required when using a temporary connection (-x flag). Refer to the Snowflake CLI documentation for more details.
Safely configure the action in your CI/CD workflow
Use WIF OIDC authentication
Requires Snowflake-CLI version 3.11 or above.
WIF OIDC authentication provides a secure and modern way to authenticate with Snowflake without storing private keys as secrets. This approach uses GitHub's OIDC (OpenID Connect) token to authenticate with Snowflake.
To set up WIF OIDC authentication, follow these steps:
Configure WIF OIDC authentication in Snowflake:
You need to setup service user with OIDC workload identity type
CREATE USER <username> TYPE = SERVICE WORKLOAD_IDENTITY = ( TYPE = OIDC ISSUER = 'https://token.actions.githubusercontent.com' SUBJECT = '<your_subject>' )For examples of see Example subject claims on GitHub.
For more information about customizing your subject, see OpenID Connect reference on GitHub.
Follow more details, see the Snowflake documentation to set up OIDC authentication for your Snowflake account and configure the GitHub OIDC provider.
Store your Snowflake account in GitHub secrets:
Store your Snowflake account identifier in GitHub Secrets. Refer to the GitHub Actions documentation for detailed instructions.
Configure the Snowflake CLI Action with OIDC authentication:
name: Snowflake OIDC on: [push] permissions: id-token: write # Required for OIDC token generation contents: read jobs: oidc-job: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: persist-credentials: false - name: Setup Snowflake cli uses: snowflakedb/[email protected] with: use-oidc: true cli-version: "3.11" - name: test connection env: SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} run: snow connection test -x
Alternative authentication methods
The following methods can be used as alternatives to OIDC authentication:
Prerequisites for key-based authentication
These steps are a prerequisite for both key-based methods:
Generate a private key:
Generate a key pair for your snowflake account following this user guide.
Store credentials in GitHub secrets:
Store each credential, such as account, private key, and passphrase in GitHub Secrets. Refer to the GitHub Actions documentation for detailed instructions on how to create and manage secrets for your repository.
Use a temporary connection
To set up Snowflake credentials for a temporary connection, follow these steps.
Map secrets to environment variables:
Map each secret to an environment variable using the format
SNOWFLAKE_<key>=<value>. For example:env: SNOWFLAKE_PRIVATE_KEY_RAW: ${{ secrets.SNOWFLAKE_PRIVATE_KEY_RAW }} SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}Configure the Snowflake CLI Action: If you want to use the latest version, you don't need to include the
cli-versionparameter. Otherwise, include it along with a specific version.Example:
- uses: snowflakedb/[email protected] with: cli-version: "3.6.0"[Optional] Set up a passphrase if private key is encrypted:
Add an environment variable named
PRIVATE_KEY_PASSPHRASEand set it to the private key passphrase. This passphrase is used by Snowflake to decrypt the private key.- name: Execute Snowflake CLI command env: PRIVATE_KEY_PASSPHRASE: ${{ secrets.PASSPHARSE }} run: | snow --version snow connection test -x[Extra] Use a password instead of a private key:
Unset the environment variable
SNOWFLAKE_AUTHENTICATOR, and then add a new variable with the password as follows:env: SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }} SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}Note: To enhance your experience when using a password and MFA, it is recommended to configure MFA caching. For more information, refer to the Snowflake CLI documentation.
For more information in setting Snowflake credentials using environment variables, refer to the Snowflake CLI documentation. And the instructions on defining environment variables within your Github CI/CD workflow can be found here.
Use a configuration file
To set up Snowflake credentials for a specific connection, follow these steps.
Add
config.tomlto your repository:Create a
config.tomlfile at the root of your repository with an empty connection configuration. For example:default_connection_name = "myconnection" [connections.myconnection]This file serves as a template and should not contain actual credentials.
Map secrets to environment variables:
Map each secret to an environment variable using the format
SNOWFLAKE_CONNECTIONS_<connection-name>_<key>=<value>. This overrides the credentials defined inconfig.toml. For example:env: SNOWFLAKE_CONNECTIONS_MYCONNECTION_PRIVATE_KEY_RAW: ${{ secrets.SNOWFLAKE_PRIVATE_KEY_RAW }} SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}Configure the Snowflake CLI action:
Add the
default-config-file-pathparameter to the Snowflake CLI action step in your workflow file. This specifies the path to yourconfig.tomlfile. For example:- uses: snowflakedb/snowflake-cli-action@v1 with: cli-version: "3.6.0" default-config-file-path: "config.toml"Replace
latestwith a specific version of Snowflake CLI action, if needed.[Optional] Set up a passphrase if private key is encrypted:
Add an additional environment variable named
PRIVATE_KEY_PASSPHRASEand set it to the private key passphrase. This passphrase is used by Snowflake to decrypt the private key.- name: Execute Snowflake CLI command env: PRIVATE_KEY_PASSPHRASE: ${{ secrets.PASSPHARSE }} run: | snow --version snow connection test[Extra] Use a password instead of private key:
Unset the environment variable
SNOWFLAKE_CONNECTIONS_MYCONNECTION_AUTHENTICATOR, and then add a new variable with the password as follows:env: SNOWFLAKE_CONNECTIONS_MYCONNECTION_USER: ${{ secrets.SNOWFLAKE_USER }} SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}Note: To enhance your experience when using a password and MFA, it is recommended to configure MFA caching. For more information, refer to the Snowflake CLI documentation.
Usage examples
Use a temporary connection
Yaml file:
name: deploy
on: [push]
jobs:
version:
name: "Check Snowflake CLI version"
runs-on: ubuntu-latest
steps:
# Snowflake CLI installation
- uses: snowflakedb/[email protected]
# Use the CLI
- name: Execute Snowflake CLI command
env:
SNOWFLAKE_AUTHENTICATOR: SNOWFLAKE_JWT
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_PRIVATE_KEY_RAW: ${{ secrets.SNOWFLAKE_PRIVATE_KEY_RAW }}
PRIVATE_KEY_PASSPHRASE: ${{ secrets.PASSPHARSE }} # Passphrase is only necessary if private key is encrypted.
run: |
snow --help
snow connection test -x
Use a configuration file
Configuration file:
default_connection_name = "myconnection"
[connections.myconnection]
Yaml file:
name: deploy
on: [push]
jobs:
version:
name: "Check Snowflake CLI version"
runs-on: ubuntu-latest
steps:
# Checkout step is necessary if you want to use a config file from your repo
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
# Snowflake CLI installation
- uses: snowflakedb/[email protected]
with:
default-config-file-path: "config.toml"
# Use the CLI
- name: Execute Snowflake CLI command
env:
SNOWFLAKE_CONNECTIONS_MYCONNECTION_AUTHENTICATOR: SNOWFLAKE_JWT
SNOWFLAKE_CONNECTIONS_MYCONNECTION_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_PRIVATE_KEY_RAW: ${{ secrets.SNOWFLAKE_PRIVATE_KEY_RAW }}
PRIVATE_KEY_PASSPHRASE: ${{ secrets.PASSPHARSE }} #Passphrase is only necessary if private key is encrypted.
run: |
snow --help
snow connection test
Install from a GitHub branch or tag
To install Snowflake CLI from a specific branch, tag, or commit in the GitHub repository (for example, to test unreleased features or a fork), use the following configuration: This feature is available from snowflake-cli-action v1.6
- uses: snowflakedb/[email protected]
with:
custom-github-ref: "feature/my-branch" # or a tag/commit hash
This will install the CLI from the specified branch, tag, or commit. You can combine this with other inputs as needed.
探索相关项目
Asabeneh/30-Days-Of-Python
30 Days of Python 编程挑战是一份循序渐进的指南,用于在 30 天内学习 Python 编程语言。这项挑战可能需要超过 100 天。请按自己的节奏进行。这些视频或许也有帮助:https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,729 星标grafana/grafana
开放且可组合的可观测性与数据可视化平台。可对来自 Prometheus、Loki、Elasticsearch、InfluxDB、Postgres 等众多数据源的指标、日志和追踪进行可视化。
77,898 星标redis/redis
对于正在构建实时数据驱动应用的开发者而言,Redis 是首选、速度最快且功能最丰富的缓存、数据结构服务器和文档与向量查询引擎。
77,491 星标apache/superset
Apache Superset 是一个数据可视化与数据探索平台
75,523 星标