google-github-actions / google-github-actions/auth

support `access_token` when using `workload_identity_provider` without `service_account`

Open
#523 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
1.4k
Forks
304
PR merge metrics
No merged PRs in 30d

Description

TL;DR

Today, this usage

      - uses: 'google-github-actions/auth@v3'
        id: 'hopefully-emit-access-token'
        with:
          workload_identity_provider: 'projects/.../locations/global/workloadIdentityPools/.../providers/...' # values masked
          token_format: 'access_token'

fails with

the GitHub Action workflow must specify a "service_account" to use when generating an OAuth 2.0 Access Token.

It is entirely possible to generate an access token for the direct workload identity principal via some extra hops (see below). It would be nice if this was simplified to "just work".


This is the workaround today:

      - uses: 'google-github-actions/auth@v3'
        with:
          workload_identity_provider: 'projects/.../locations/global/workloadIdentityPools/.../providers/...' # values masked
      - uses: 'google-github-actions/setup-gcloud@v3'
      - name: 'emit access token'
        id: 'emit-access-token'
        run: |
          token="$(gcloud auth print-access-token)"
          echo "::add-mask::$token"
          echo "access-token=$token" >> "$GITHUB_OUTPUT"

... and ${{ steps.emit-access-token.outputs.access-token }} is available for all later steps in the job.

Detailed design

See above.

Additional information

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the auth action's handling of token_format: access_token when only workload_identity_provider is supplied. Compare that path with the documented gcloud auth print-access-token workaround. Done means the action directly produces an access token for the workload identity principal without requiring service_account, while preserving the later-step output behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, google-cloud, typescript
Domain
authentication, ci-cd, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.