小编Joe*_*Joe的帖子

GitHub 操作失败,错误:无权执行 sts:AssumeRoleWithWebIdentity

我有两个 GitHub Actions,两者都是相同的,只是一个是手动触发的,另一个是在主分支上完成拉取请求时触发的。手动部署工作流程工作得很好,但是部署工作流程失败,并显示“错误:未授权执行 sts:AssumeRoleWithWebIdentity”。我缺少什么?我的猜测是两个事件之间的子项一定是不同的?我该如何检查?

这有效

name: manual-deploy
on:
  workflow_dispatch:

env:
  REACT_APP_VERSION: 0.1.0

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read
    steps:
      - name: checkout code
        uses: actions/checkout@v3
        
      - name: install node
        uses: actions/setup-node@v3
        # using later versions of node breaks due to react-scripts v5.0.1 incompatible with typescript v5;
        # this specific node version works though
        with:
          node-version: "16.14.2"

      - name: install dependencies
        run: npm install
        
      - name: run tests
        run: npm run test

      - name: get current date
        id: …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-iam github-actions

3
推荐指数
1
解决办法
2442
查看次数