我有一堆使用 Azure Pipelines 进行 CI/CD 的存储库,我现在正在尝试将其移植到 Github Actions。这是我正在研究的第一个:https://github.com/Azure/AzureAuth/tree/fix-ghaction
我已经完成了 99% 的工作,但在某一步骤中我遇到了奇怪的身份验证错误。该存储库已镜像到另一个组织(cloudyr),我使用此步骤进行镜像:
- name: Copy to Cloudyr
if: runner.os == 'Linux'
env:
token: "${{ secrets.ghPat }}"
run: |
export CLOUDYR_REPO=$(echo $GITHUB_REPOSITORY | sed "s/Azure/cloudyr/")
git push --prune https://$token@github.com/${CLOUDYR_REPO}.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
Run Code Online (Sandbox Code Playgroud)
这会从存储库机密中检索 PAT,并执行git push. 它与 Azure Pipelines 完美配合,但现在失败并出现以下错误:
Run export CLOUDYR_REPO=$(echo $GITHUB_REPOSITORY | sed "s/Azure/cloudyr/")
remote: Permission to cloudyr/AzureAuth.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/cloudyr/AzureAuth.git/': The requested URL returned error: 403
Error: Process completed with exit code …Run Code Online (Sandbox Code Playgroud)