I needed to add:
jobs:
my_job:
# Need to add these 3 lines to add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
This is documented here: https://github.com/google-github-actions/auth#usage
Answer from Brian C. on Stack OverflowI needed to add:
jobs:
my_job:
# Need to add these 3 lines to add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
This is documented here: https://github.com/google-github-actions/auth#usage
For me, what I missing are
- Ensure the value for workload_identity_provider is the full Provider name, not the Pool name:
- projects/NUMBER/locations/global/workloadIdentityPools/POOL
+ projects/NUMBER/locations/global/workloadIdentityPools/POOL/providers/PROVIDER
- Need to have permission
permissions:
contents: 'read'
id-token: 'write'
Check out this https://github.com/google-github-actions/auth/blob/main/docs/TROUBLESHOOTING.md
Authenticate to multiple gcloud accounts with GitHub Actions - Stack Overflow
Authenticating to docker using gcloud isn't working after this action
Github Actions | google cloud authentication - Stack Overflow
Google artifact regitsry NPM + github action - Stack Overflow
Videos
For anyone trying to resolve this issue, make sure you have the IAM Service Account Credentials API API enabled, iamcredentials.googleapis.com in your GCP project first, which then enables the creation of short-lived tokens for service account impersonations.
I run into the same error yesterday. I made a typo in the step 8 of google-github-actions configuration and the new permission of the service account was wrong.
You can check it through the IAM page -> Service Accounts -> Permissions (tab).