首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >github actions/auth失败,没有注入$ACTIONS_ID_TOKEN_REQUEST_TOKEN或$ACTIONS_ID_TOKEN_REQUEST_URL

github actions/auth失败,没有注入$ACTIONS_ID_TOKEN_REQUEST_TOKEN或$ACTIONS_ID_TOKEN_REQUEST_URL
EN

Stack Overflow用户
提问于 2022-09-06 19:20:50
回答 1查看 738关注 0票数 5

在github操作中,我正在运行一个尝试将github用于GCP联邦id的操作:

代码语言:javascript
复制
     # 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: 'my-github-sa@projxyz.iam.gserviceaccount.com'

我得到了:

代码语言:javascript
复制
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注入这些值?

EN

回答 1

Stack Overflow用户

发布于 2022-09-06 19:23:48

我需要补充一句:

代码语言:javascript
复制
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#usage

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73626841

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档