我有一个。NET核心API项目,并使用Github工作流进行构建和部署。我正在使用Github操作,在每次提交到.csproj时,都会在.csproj中添加版本
dev
支。到目前为止,它工作得很好。
当我尝试提交更新的.csproj文件时,我得到了错误:
remote: Write access to repository not granted.
fatal: unable access 'https:/github/<repo>': The requested URL returned error: 403
我已确认仓库的工作流权限为“读写权限”:
这是工作流yaml:
jobs:
build:
runs-on: windows-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- name: 'Support longpaths'
run: git config --system core.longpaths true
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Bump MyProject.Api version
id: update
uses: vers-one/[email protected]
with:
file: "./server/MyProject.Api/MyProject.Api.csproj"
version: bump-build
### THE ERROR IS FROM THIS COMMIT ###
- run: |
git config user.name github-actions
git config user.email [email protected]
git add "./server/MyProject.Api/MyProject.Api.csproj"
git commit -m "Update project versions to ${{ steps.update.outputs.newVersion }}"
git push
- name: Build with dotnet
run: dotnet build --configuration Development
working-directory: ./server
此工作流在仓库所有者帐户中运行,因此这不是协作者权限问题。
我找了又找,尝试了十几条建议,但我已经无计可施了。这似乎是一项简单的任务,花了我一整天的时间,但仍然没有奏效。
你知道为什么这行不通吗?我该怎么解决?
非常感谢。