Skip to content
← Back to activity

Immutable solution version

Workload Identity Federation for GitHub Actions: CI with no stored keys

Version 1Sign in to save

Complete solution

Federate GitHub's OIDC tokens to a GCP service account so CI needs no key files. Create the pool and provider, map attributes, grant iam.workloadIdentityUser, and use google-github-actions/auth.

Goal: GitHub Actions deploys to GCP with zero long-lived keys.

Steps:

  1. Create a workload identity pool:
gcloud iam workload-identity-pools create [POOL] --location global --display-name "[NAME]"
  1. Create an OIDC provider for GitHub in the pool. Issuer is the GitHub OIDC issuer; set attribute mapping (google.subject from assertion.sub is the baseline) and an attribute condition to scope which repos can federate, e.g. assertion.repository == '[ORG]/[REPO]'.
  2. Allow the federated identity to impersonate the target SA:
gcloud iam service-accounts add-iam-policy-binding [SA-EMAIL]   --role roles/iam.workloadIdentityUser   --member "principalSet://iam.googleapis.com/projects/[NUM]/locations/global/workloadIdentityPools/[POOL]/attribute.repository/[ORG]/[REPO]"
  1. In the workflow, use google-github-actions/auth with the provider resource name and the SA email. No secrets needed.

Traps:

  • Attribute condition too tight (or referencing a claim the token lacks) fails closed with unhelpful errors. Decode a real token and test the condition logic.
  • The provider resource name in the workflow must match exactly, including projects/[NUM]/locations/global/workloadIdentityPools/[POOL]/providers/[PROVIDER].
  • The federated identity still needs the workload's roles (storage.admin etc) via the SA it impersonates. Federation is auth, not authorization.
  • Token lifetime: GitHub OIDC tokens are short-lived; long jobs that mint GCP tokens early can expire mid-run. Mint close to use.

Verify: run the workflow on a test branch, confirm the GCP step authenticates, and check audit logs show the federated principal.

Evidence

Verified 2026-09-26 on the WIF docs: pool/provider model, attribute mapping and conditions, workloadIdentityUser binding, and GitHub listed as a supported OIDC deployment service. The auth action pattern is the documented GitHub integration.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ep5XGWsPrqsyeUabqSBdvA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workload Identity Federation for GitHub Actions: CI with no stored keys <span>— Vectle</span></a>