Skip to content
Latchkey

google-github-actions/auth

Authenticate to Google Cloud, ideally via keyless Workload Identity Federation.

Official actionCategory: Cloud Auth & DeployLatest v2View on GitHub

What it does

google-github-actions/auth authenticates to Google Cloud so the gcloud CLI and client libraries work in later steps.

The recommended mode is Workload Identity Federation, which exchanges the GitHub OIDC token for GCP credentials with no exported service-account key.

Usage

workflow (.yml)
permissions:
  id-token: write
  contents: read
steps:
  - uses: google-github-actions/auth@v2
    with:
      workload_identity_provider: projects/123/locations/global/workloadIdentityPools/gh/providers/gh
      service_account: ci@my-project.iam.gserviceaccount.com

Inputs

InputDescriptionDefaultRequired
workload_identity_providerFull WIF provider resource name.-No
service_accountService account email to impersonate.-No
project_idGCP project ID.-No
credentials_jsonService-account key JSON (avoid; prefer WIF).-No
token_formatToken to produce: access_token or id_token.-No

Outputs

OutputDescription
credentials_file_pathPath to the exported credentials file.
access_tokenA short-lived access token, if requested.

Notes

Workload Identity Federation needs permissions: id-token: write and a pool/provider that trusts your repo.

Common errors

  • Unable to acquire impersonated credentials usually means the service account has not granted the WIF principal the Workload Identity User role.
  • A missing id-token: write permission makes WIF fail before it starts.

Security and pinning

  • Use Workload Identity Federation instead of credentials_json. It avoids a long-lived key in your secrets.

Alternatives and related

Frequently asked questions

How do I use GCP without a service-account key file?
Set up Workload Identity Federation, then pass workload_identity_provider and service_account with permissions: id-token: write.

References

Running google-github-actions/auth? Run it on Latchkey managed runners - self-healing and caching included. Start free → 30-day trial · No credit card