Skip to content

support access_token when using workload_identity_provider without service_account #523

Description

@StephenWithPH

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions