运行Workflow下载Artifact时遭遇AuthenticationFailed错误求助
排查GitHub Workflow认证失败问题
错误信息
<?xml version="1.0" encoding="utf-8"?> <Error> <Code>AuthenticationFailed</Code> <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:b37a6424-701e-004c-55dc-da07c1000000 Time:2024-07-20T19:39:41.7435261Z </Message> </Error>
对应的Workflow配置
name: check actions run-name: check actions on: workflow_dispatch: push: jobs: artifacts: name: Build runs-on: ubuntu-latest steps: - name: use action uses: Legit-Labs/action-download-artifact@v2 with: github_token: ${{ secrets.TOKEN }} workflow: artifact.yml path: ${{ github.workspace }} - run: ls -la
排查步骤
验证Token的正确性
- 确认仓库Secrets中存在
TOKEN,且拼写完全匹配(大小写敏感)。 - 检查Token权限:私有仓库需至少拥有
repo权限,公有仓库需public_repo权限;跨仓库下载artifact时,默认GITHUB_TOKEN权限不足,必须使用个人访问令牌(PAT)。 - 重新生成PAT并更新Secrets,确保粘贴时无多余空格或换行符。
- 确认仓库Secrets中存在
完善Workflow参数配置
- 确认
artifact.yml在目标仓库中存在,文件名拼写完全一致(GitHub对文件名大小写敏感)。 - 若
artifact.yml属于其他仓库,必须补充repo和owner参数,示例:with: github_token: ${{ secrets.TOKEN }} workflow: artifact.yml repo: target-repo-name owner: target-username path: ${{ github.workspace }}
- 确认
检查Token有效期
- 若使用的是带过期时间的PAT,确认Token未过期,必要时生成无过期限制的PAT测试。
内容的提问来源于stack exchange,提问作者Mario
相关产品推荐
相关产品推荐

