Google Cloud experiments #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Google Cloud experiments | |
on: workflow_dispatch | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
google-admin: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# https://github.com/google-github-actions/auth?tab=readme-ov-file#workload-identity-federation-through-a-service-account | |
- uses: google-github-actions/auth@v2 | |
id: auth | |
with: | |
project_id: savvy-container-267322 | |
workload_identity_provider: projects/47855944311/locations/global/workloadIdentityPools/github/providers/oidc | |
service_account: my-service-account@savvy-container-267322.iam.gserviceaccount.com | |
# https://admin.google.com/u/1/ac/roles | |
# .. create role and assign admin (service account email) | |
- uses: google-github-actions/setup-gcloud@v2 | |
- run: | | |
set -x | |
gcloud auth list | |
curl https://admin.googleapis.com/admin/directory/v1/users?customer=C01jv3tsi \ | |
--header "Authorization: Bearer $(gcloud auth print-access-token)" \ | |
| jq -r '.users[].id' |