This GitHub Action manages environment variables in Quant Cloud environments.
- List all environment variables
- Set variables from multiple sources:
- .env files
- JSON strings
- Individual KEY=VALUE pairs
- Merge mode (default): Updates/adds variables individually, preserves existing ones
- Replace mode (
replace: true): Uses bulk API to replace ALL variables at once
- Clear all variables in an environment (fast bulk operation)
- Delete specific variables by key
- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: list- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: set
env_file: .env.productionReplace ALL existing variables (removes any not in the input):
- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: set
replace: true # Removes all existing vars not in .env.production
env_file: .env.productionreplace: true, any existing variables NOT in your input will be deleted!
- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: set
json_vars: |
{
"DATABASE_URL": "postgres://...",
"API_KEY": "secret123",
"DEBUG": "false"
}- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: set
variables: |
DATABASE_URL=postgres://...
API_KEY=secret123
DEBUG=falseVariables from all sources are merged (later sources override earlier ones):
- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: set
env_file: .env.production # Base configuration
json_vars: '{"API_KEY": "override"}' # Override specific values
variables: DEBUG=true # Final overrides- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: delete
keys: |
OLD_VAR_1
OLD_VAR_2
DEPRECATED_KEY- uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: staging
operation: clearname: Deploy with Environment Variables
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Clear existing variables
- name: Clear old variables
uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: clear
# Set new variables from .env file
- name: Set production variables
uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: set
env_file: .env.production
variables: |
BUILD_NUMBER=${{ github.run_number }}
COMMIT_SHA=${{ github.sha }}
# List variables for verification
- name: List variables
id: list-vars
uses: quantcdn/quant-cloud-environment-var-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: your-org-id
app_name: my-app
environment_name: production
operation: list
- name: Show variable count
run: echo "Total variables: ${{ steps.list-vars.outputs.count }}"| Input | Description | Required | Default |
|---|---|---|---|
api_key |
Quant API key | Yes | - |
organization |
Quant organisation ID | Yes | - |
app_name |
Name of your application | Yes | - |
environment_name |
Name of the environment | Yes | - |
operation |
Operation to perform: list, set, clear, delete |
No | list |
replace |
Replace ALL variables (removes any not in input). Uses bulk API. Only for set operation. |
No | false |
base_url |
Quant Cloud API base URL | No | https://dashboard.quantcdn.io |
env_file |
Path to .env file (for set operation) |
No | - |
json_vars |
JSON string of variables (for set operation) |
No | - |
variables |
Newline or comma-separated KEY=VALUE pairs (for set operation) |
No | - |
keys |
Newline or comma-separated list of variable keys (for delete operation) |
No | - |
| Output | Description | Operations |
|---|---|---|
variables |
JSON string of all variables | list |
count |
Number of variables | list |
updated_count |
Number of variables successfully set | set |
deleted_count |
Number of variables successfully deleted | clear, delete |
failed_count |
Number of variables that failed to update/delete | set, clear, delete |
Lists all environment variables for the specified environment. Variable keys are logged, but values are only available in the variables output (for security).
Sets or updates environment variables. Behavior depends on the replace parameter:
Merge Mode (default, replace: false):
- Updates each variable individually via separate API calls
- Preserves existing variables not in your input
- Safe for adding/updating specific variables
- Slower for large batches but safer
Replace Mode (replace: true):
- Uses the fast bulk API (single API call)
- Replaces ALL variables - removes any not in your input
- Fast for complete environment resets
⚠️ Destructive: Deletes existing variables not specified
Supports three input methods that can be combined:
-
env_file: Path to a .env file
- Supports
KEY=VALUEformat - Handles comments (lines starting with #)
- Strips quotes from values
- Supports
-
json_vars: JSON object as a string
- Must be valid JSON:
{"KEY": "value", ...}
- Must be valid JSON:
-
variables: Individual KEY=VALUE pairs
- Newline or comma-separated
- Example:
KEY1=value1\nKEY2=value2
Variables are merged with priority: env_file → json_vars → variables (later overrides earlier)
Deletes all environment variables in the specified environment using the fast bulk API. Sends an empty array to clear all variables in a single operation.
Deletes specific environment variables by key. Provide a newline or comma-separated list of keys in the keys input.
The action supports standard .env file format:
# Comments are ignored
DATABASE_URL=postgres://user:pass@host:5432/db
API_KEY=secret123
# Quoted values are supported
APP_NAME="My Application"
APP_DESCRIPTION='A great app'
# Empty lines are ignored
DEBUG=true
PORT=3000- Failed operations log warnings but don't fail the action
- Outputs include
failed_countto track partial failures - 404 errors on delete operations are treated as success (already deleted)
- For
setoperations, the action continues even if some variables fail
- API keys should always be stored in GitHub Secrets
- Variable values are never logged (only keys are shown in logs)
- The
listoperation outputs values only in thevariablesoutput, not in logs - Consider using GitHub Environments with protection rules for production deployments
npm install
npm run buildSet environment variables and run the test script:
export QUANT_API_KEY=your-api-key
export QUANT_ORGANIZATION=your-org-id
export QUANT_APP_NAME=your-app
export QUANT_ENVIRONMENT_NAME=your-environment
node test-dist/test-local.js