Installs the GitOps Platform CLI
(gops) and runs it in your GitHub Actions workflows: code security reports,
vault secret exports and secret management.
- uses: getgitops/cli-github-action@v1
with:
command: creport scan
api-key: ${{ secrets.GITOPS_API_KEY }}
service: my-service
project: my-projectRuns Trivy, Syft and Gitleaks on the repository and uploads the results. Git metadata (branch, commit, author, repository URL and ref) is detected from the GitHub context, pull requests included. The scanners are cached between runs.
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: getgitops/cli-github-action@v1
with:
command: creport scan
api-key: ${{ secrets.GITOPS_API_KEY }}
service: my-service
project: my-project
tags: github-actions, ciWith export-env: true every secret is masked in the logs and available as an
environment variable in the following steps of the job.
- uses: getgitops/cli-github-action@v1
with:
command: vault export
api-key: ${{ secrets.GITOPS_API_KEY }}
project-id: 00000000-0000-0000-0000-000000000000
path: /
environment: production
export-env: true
- run: ./deploy.sh # DATABASE_URL, API_TOKEN... are available here- uses: getgitops/cli-github-action@v1
with:
command: vault export
api-key: ${{ secrets.GITOPS_API_KEY }}
project-id: 00000000-0000-0000-0000-000000000000
environment: production
format: json
output: secrets.json
- run: jq 'keys' secrets.jsonWarning
The file contains plain-text secrets. Don't upload it as an artifact or include it in a Docker build context unless that's intended.
The secrets are only visible to that command.
- uses: getgitops/cli-github-action@v1
with:
command: vault run
api-key: ${{ secrets.GITOPS_API_KEY }}
project-id: 00000000-0000-0000-0000-000000000000
environment: production
run: npm run migratecommand accepts vault secret create, vault secret get,
vault secret update and vault secret delete.
- uses: getgitops/cli-github-action@v1
with:
command: vault secret update
api-key: ${{ secrets.GITOPS_API_KEY }}
project-id: 00000000-0000-0000-0000-000000000000
path: /database
key: DB_PASSWORD
environment: production
value: ${{ secrets.NEW_DB_PASSWORD }}Without command the action only installs the CLI and adds gops to the
PATH, so you can call it from your own steps.
- uses: getgitops/cli-github-action@v1
with:
version: 1.2.1
- run: gops --help| Input | Commands | Default | Description |
|---|---|---|---|
command |
creport scan, vault export, vault run, vault secret create|get|update|delete, tools install. Empty: install only. |
||
version |
all | latest |
Version, dist-tag or semver range of @getgitops/cli. |
api-url |
all | https://cloud.getgitops.com/api |
GitOps Platform API base URL. |
api-key |
all except tools install |
API key. Use a secret. | |
working-directory |
all | . |
Directory the command runs in. |
args |
all | Extra CLI arguments, one per line. | |
service |
creport scan |
Service slug. | |
project |
creport scan |
Project slug. | |
tags |
creport scan |
Tags separated by commas, spaces or new lines. | |
git-branch, git-commit, git-repo-url, git-author, git-version |
creport scan |
detected | Override the git metadata detected from the GitHub context. |
cache-tools |
creport scan, tools install |
true |
Cache the scanners between runs. |
project-id |
vault * |
Project ID. | |
path |
vault * |
/ |
Vault path. |
environment |
vault export, vault run, vault secret create|update |
Vault environment slug. | |
format |
vault export |
env |
env or json. |
output |
vault export |
File the secrets are written to. Required unless export-env is true. |
|
export-env |
vault export |
false |
Export the secrets as masked environment variables for the next steps. |
run |
vault run |
Shell command run with the secrets injected. | |
key |
vault secret * |
Secret key. | |
value |
vault secret create|update |
Secret value. Masked in the logs. | |
secret-description |
vault secret create|update |
Secret description. |
| Output | Description |
|---|---|
version |
Installed version of @getgitops/cli. |
output-file |
vault export: absolute path of the exported file (only when output is set). |
- Linux or macOS runners (
x64orarm64). Windows is not supported. - Node.js 20 or later. If the runner doesn't have it, the action sets it up
with
actions/setup-node.
- Inputs are passed to the CLI as environment variables, never interpolated into shell scripts, so they can't inject commands.
api-key,valueand every secret exported withexport-envare masked in the logs.- Pin the action to a full version (
@v1.0.0) or a commit SHA if you need reproducible builds;@v1follows the latestv1.x.yrelease.
- Create a release with a
vX.Y.Ztag and select Publish this Action to the GitHub Marketplace. - The
Update major tagworkflow movesvXto the new release.
