69 lines
2.4 KiB
Markdown
69 lines
2.4 KiB
Markdown
# Fetch Secret from Infisical
|
|
|
|
<!-- action-docs-description source="action.yml" -->
|
|
## Description
|
|
|
|
Fetches one or more secret values from Infisical using a machine identity token
|
|
<!-- action-docs-description source="action.yml" -->
|
|
|
|
<!-- action-docs-inputs source="action.yml" -->
|
|
## Inputs
|
|
|
|
| name | description | required | default |
|
|
| --- | --- | --- | --- |
|
|
| `INFISICAL_TOKEN` | <p>Machine identity access token</p> | `true` | `""` |
|
|
| `SECRET_NAME` | <p>A single secret key to fetch; its value is returned base64-encoded in the <code>value</code> output</p> | `false` | `""` |
|
|
| `SECRET_NAMES` | <p>Secret keys to fetch, separated by newlines, commas, or spaces; each is exported as an environment variable of the same name for subsequent steps</p> | `false` | `""` |
|
|
| `INFISICAL_HOST` | <p>Infisical API base URL</p> | `false` | `https://infisical.pixelparasol.com` |
|
|
| `WORKSPACE_ID` | <p>Infisical project UUID</p> | `true` | `""` |
|
|
| `ENVIRONMENT` | <p>Infisical environment slug</p> | `false` | `prod` |
|
|
| `SECRET_PATH` | <p>Folder path within the environment</p> | `false` | `/` |
|
|
<!-- action-docs-inputs source="action.yml" -->
|
|
|
|
<!-- action-docs-outputs source="action.yml" -->
|
|
## Outputs
|
|
|
|
| name | description |
|
|
| --- | --- |
|
|
| `value` | <p>The fetched <code>SECRET_NAME</code> value (base64-encoded)</p> |
|
|
<!-- action-docs-outputs source="action.yml" -->
|
|
|
|
<!-- action-docs-runs source="action.yml" -->
|
|
## Runs
|
|
|
|
This action is a `composite` action.
|
|
<!-- action-docs-runs source="action.yml" -->
|
|
|
|
## Usage
|
|
|
|
### Multiple secrets
|
|
|
|
Each name in `SECRET_NAMES` is exported as an environment variable of the same name (raw value, not base64) to all subsequent steps in the job. Names must be valid environment variable names. The action fails if any secret is missing.
|
|
|
|
```yaml
|
|
- uses: pixel-parasol-public/gitea-actions/infisical/fetch-secret@main
|
|
with:
|
|
INFISICAL_TOKEN: ${{ secrets.INFISICAL_TOKEN }}
|
|
WORKSPACE_ID: <project-uuid>
|
|
SECRET_NAMES: |
|
|
DATABASE_URL
|
|
API_KEY
|
|
|
|
- run: ./deploy.sh # $DATABASE_URL and $API_KEY are set
|
|
```
|
|
|
|
### Single secret
|
|
|
|
```yaml
|
|
- id: secret
|
|
uses: pixel-parasol-public/gitea-actions/infisical/fetch-secret@main
|
|
with:
|
|
INFISICAL_TOKEN: ${{ secrets.INFISICAL_TOKEN }}
|
|
WORKSPACE_ID: <project-uuid>
|
|
SECRET_NAME: DATABASE_URL
|
|
|
|
- run: echo "${{ steps.secret.outputs.value }}" | base64 -d > db_url
|
|
```
|
|
|
|
`SECRET_NAME` and `SECRET_NAMES` can be combined in one call.
|