Snowflake CLI GitHub Action¶
The Snowflake CLI GitHub Action (snowflakedb/snowflake-cli-action (https://github.com/snowflakedb/snowflake-cli-action)) installs and configures Snowflake CLI in a GitHub Actions workflow. Use it to automate Snowflake deployments (DCM projects, Snowpark applications, Snowflake Native Apps, and SQL scripts) from your GitHub repository.
How it works¶
The action performs these steps on the runner:
Installs Python 3.11 and the
uvpackage manager using astral-sh/setup-uv (https://github.com/astral-sh/setup-uv).Installs Snowflake CLI in an isolated environment (
uv tool install snowflake-cli).Copies
config.tomlfrom the repository to~/.snowflake/config.toml(0600on Linux/macOS). Skipped if the file is absent.When OIDC authentication is enabled, obtains a GitHub-issued OIDC token and sets the Snowflake workload identity environment variables for subsequent steps.
After the action completes, the snow command is available on PATH for every subsequent step in the job.
Quick usage example¶
The following workflow authenticates with Snowflake using OIDC and runs a connection test:
For other authentication methods, see Authentication methods.
Version pinning¶
The action supports three pin styles:
Commit SHA (
@a1b2c3d...): pins to a specific commit.Patch version tag (
@v2.0.2): pins to a specific release.Floating major tag (
@v2): follows the latest release in that major version.
Inputs¶
The action accepts the following inputs, specified under with: in your workflow YAML:
Input |
Required |
Default |
Description |
|---|---|---|---|
|
No |
(latest) |
Snowflake CLI version to install, for example |
|
No |
(none) |
GitHub branch, tag, or commit to install Snowflake CLI from. Use this to test unreleased features or a fork. Mutually exclusive with |
|
No |
|
Path to your |
|
No |
|
When |
|
No |
|
Name of the environment variable the OIDC token is exported as. Set this to |
Note
Specify only one of cli-version or custom-github-ref; using both at the same time results in an error.
Authentication methods¶
The action supports three ways of authenticating with Snowflake. Snowflake recommends OIDC because it avoids storing long-lived secrets in GitHub.
Method |
Security |
Secrets required |
Snowflake CLI version |
|---|---|---|---|
Workload identity federation (WIF) with OIDC (recommended) |
Secretless, short-lived tokens |
Snowflake account only |
3.11 or later |
Private key stored in GitHub Secrets |
Private key, account, user |
Any |
|
Password stored in GitHub Secrets |
Password, account, user |
Any |
Workload identity federation (WIF) with OIDC¶
Note
OIDC authentication requires Snowflake CLI version 3.11.0 or later.
With OIDC, GitHub issues a short-lived OpenID Connect token that Snowflake validates directly. No private key or password is stored in GitHub.
Create the service user¶
Create a Snowflake service user that trusts GitHub’s OIDC provider:
The SUBJECT must match the claim GitHub emits for the workflow. Use one of the following formats:
Subject format |
Matches |
Workflow requirement |
|---|---|---|
|
Push to the specified branch |
|
|
Any pull request event |
|
|
Job targets a named GitHub environment |
Job sets |
When a job sets environment:, GitHub uses the environment form regardless of the trigger.
To customize the subject to include a broader claim such as repository_owner, see the GitHub OpenID Connect reference (https://docs.github.com/en/actions/reference/security/oidc).
Configure the action¶
Grant id-token: write permission to the job and set use-oidc: true on the action:
When use-oidc: true is set, the action exports the following environment variables for subsequent steps:
SNOWFLAKE_AUTHENTICATOR=WORKLOAD_IDENTITYSNOWFLAKE_WORKLOAD_IDENTITY_PROVIDER=OIDCSNOWFLAKE_AUDIENCE=snowflakecomputing.cnSNOWFLAKE_TOKEN=<token>(or the variable named byoidc-token-name)
For broader context, see Workload identity federation.
Key pair authentication¶
Store your Snowflake private key as a GitHub secret and pass it through the environment. You can use a temporary connection (no config.toml required) or a named connection defined in config.toml.
Temporary connection:
Named connection: commit a config.toml with an empty connection block and override the fields through environment variables:
For more information about connections, see Managing Snowflake connections.
Password authentication¶
Password authentication is supported for legacy workflows but is not recommended for production CI/CD. To use it, omit SNOWFLAKE_AUTHENTICATOR (the CLI defaults to password authentication) and pass SNOWFLAKE_PASSWORD:
Note
When using a password and MFA, Snowflake recommends enabling MFA caching.
Installing from a branch, tag, or commit¶
To test an unreleased Snowflake CLI change or a fork, use custom-github-ref:
Platform support¶
The action runs on Ubuntu, macOS, and Windows GitHub-hosted runners and is tested against Python 3.10 and 3.13. Note the following platform-specific behavior:
Linux and macOS: the copied
config.tomlis set to0600permissions.Windows: file permissions on
config.tomlare not modified. Use GitHub Secrets for credentials; avoid committing secrets toconfig.tomlregardless of the runner.