我想使用Github操作将文件推入当前的存储库。
我编写了一个使用正式actions/checkout@v3操作的基本配置。我的配置几乎与自述实例中的配置相同
name: Example
on: workflow_dispatch
jobs:
example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- shell: bash
run: |
date > 1.txt
git config user.name github-actions
git config user.email github-actions@github.com
git add 1.txt
git commit -m updated
git push这种配置对于任何存储库都很好,但Github页面存储库除外。错误是:
remote: Permission to sirekanian/sirekanian.github.io.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/sirekanian/sirekanian.github.io/': The requested URL returned error: 403
Error: Process completed with exit code 128.为什么GitHub页面存储库与普通存储库不同?GitHub页面存储库是否具有不允许插入的不同权限?
我发现的最相似的问题是如何让github操作工作流使用bot名称将生成的文档推送到同一组织中的其他存储库。答案是使用令牌,但我认为我应该使用默认令牌。
发布于 2022-09-12 09:31:55
GitHub页面存储库似乎具有不同的默认权限设置。如果添加要写入内容的权限,则可以使用GitHub签出操作将其推送到存储库:
name: Example
on: workflow_dispatch
permissions:
contents: write
jobs:
# your push job herehttps://stackoverflow.com/questions/73687176
复制相似问题