github アクションで、github から GCP フェデレーション ID を使用しようとするアクションを実行しています。
# see https://github.com/marketplace/actions/authenticate-to-google-cloud#setup
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: 'projects/1234/locations/global/workloadIdentityPools/my-github-pool/providers/my-github-oidc-provider'
service_account: '[email protected]'
私が得ているのは:
Run google-github-actions/auth@v0
Error: google-github-actions/auth failed with: retry function failed after 1 attempt:
gitHub Actions did not inject $ACTIONS_ID_TOKEN_REQUEST_TOKEN or
$ACTIONS_ID_TOKEN_REQUEST_URL into this job.
This most likely means the GitHub Actions workflow permissions are incorrect, or this job is being run from a fork.
For more information, please see https://docs.github.com/en/actions/security-guides/automatic-
token-authentication#permissions-for-the-github_token
参照されているドキュメントを見ていますが、役に立つものは何も見つかりません。
GH にそれらの値を挿入させるにはどうすればよいですか?
ベストアンサー1
追加する必要がありました:
jobs:
my_job:
# Need to add these 3 lines to add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
これはここに文書化されています:https://github.com/google-github-actions/auth#使用方法