No description
  • TypeScript 100%
Find a file
Alex Dadgar d61396ec63
Merge pull request #24 from hashicorp/dependabot/npm_and_yarn/npm-development-68e34cdd7b
Bump the npm-development group across 1 directory with 5 updates
2024-09-05 16:17:15 -07:00
.github Follow update guidance from https://github.com/super-linter/super-linter/blob/main/docs/upgrade-guide.md#javascript_default_style-and-typescript_default_style 2024-09-05 16:03:16 -07:00
dist Rebuild 2024-09-05 16:10:21 -07:00
src Run npm run all/bundle 2024-06-25 09:49:43 -07:00
.copywrite.hcl copywrite config to ignore dist 2024-07-01 10:30:16 -07:00
.eslintignore Initial commit; largely copying from hashicorp/hcp-auth-action 2024-06-12 15:28:47 -07:00
.gitattributes Initial commit; largely copying from hashicorp/hcp-auth-action 2024-06-12 15:28:47 -07:00
.gitignore Initial commit; largely copying from hashicorp/hcp-auth-action 2024-06-12 15:28:47 -07:00
.node-version Initial commit; largely copying from hashicorp/hcp-auth-action 2024-06-12 15:28:47 -07:00
.prettierignore Initial commit; largely copying from hashicorp/hcp-auth-action 2024-06-12 15:28:47 -07:00
.prettierrc.json Initial commit; largely copying from hashicorp/hcp-auth-action 2024-06-12 15:28:47 -07:00
action.yml Add copywrite headers 2024-06-24 16:22:55 -07:00
LICENSE Add copywrite headers 2024-06-24 16:22:55 -07:00
package-lock.json Bump the npm-development group across 1 directory with 5 updates 2024-09-05 16:14:03 -07:00
package.json Bump the npm-development group across 1 directory with 5 updates 2024-09-05 16:14:03 -07:00
README.md Fix example Vault Secrets command 2024-07-12 16:52:34 -07:00
tsconfig.json Initial commit; largely copying from hashicorp/hcp-auth-action 2024-06-12 15:28:47 -07:00

Setup the hcp CLI for use in GitHub Actions

Configures the hcp CLI for use in GitHub Actions. The Action installs the specified version of hcp and configures the hcp CLI for use in GitHub Actions. The downloaded hcp CLI is cached in the GitHub Actions workspace for subsequent use. For a full list of available hcp CLI commands, see the hcp CLI documentation.

Usage

jobs:
  job_id:
    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
      - id: 'Authenticate to HCP'
      - uses: 'hashicorp/hcp-auth-action@v0'
        with:
          workload_identity_provider: 'iam/project/123456789/service-principal/my-sp/workload-identity-provider/github'

      - name: 'Download hcp CLI'
        uses: 'hashicorp/hcp-setup-action@v0'
        with:
          version: 'latest'

      - name: 'Use hcp CLI to read a secret'
        run: |
          MY_SECRET=$(hcp vault-secrets secrets open \
            --app=cli --format=json foo | jq -r '.static_version.value')
          echo "::add-mask::$MY_SECRET"
          echo "MY_SECRET=$MY_SECRET" >> $GITHUB_ENV

Inputs

  • version - (Optional) A string specifying which version of the hcp CLI to use. The following are valid version strings:

    • ``: Use the currently installed version of the hcpCLI. If thehcp CLI is not installed, the latest version will be installed.
    • latest: Use the latest version of the hcp CLI.
    • Specific version (e.g. 0.4.0): Specifies the exact version of the hcp CLI to use.
    • Version constraint (e.g. >= 0.3.0): Specifies a version constraint for the hcp CLI. The latest version that satisfies the constraint will be used. See SemVer for details on constructing a version constraint string.
  • project_id - (Optional) Configure the default HCP Project ID for the hcp CLI. This is equivalent to running hcp profile set project_id <project_id>. Individual commands can override this value by setting the --project flag.

Authentication

To use the hcp CLI, it must first be authenticated using the hcp-auth-action Action The hcp-auth-action Action supports authenticating the hcp CLI using Service Principal credentials or using Workload Identity Federation.

See the hcp-auth-action Action documentation for more information on authenticating the hcp CLI.