GitHub Actions 不允许创建或批准拉取请求 (createPullRequest)

Dev*_*xln 27 github github-actions

Allow GitHub Actions to create and approve pull requests自本月 5 月 3 日起,github在 github actions 下添加了创建拉取请求的设置Settings > Actions > General。但是,我似乎无法为我的存储库选择此选项,它呈灰色,没有任何解释为什么它呈灰色。

每当更改并保存“默认权限”设置时,都可以选择Allow GitHub Actions to create and approve pull requests,但如果保存,它会恢复到原始的灰色版本,未选中。

我还尝试向工作流程文件授予拉取请求权限,如下所示:

permissions:
   pull-requests: write
Run Code Online (Sandbox Code Playgroud)

但这也不起作用。我是否缺少某些内容,导致我无法在 github 操作中使用拉取请求?

“允许 GitHub Actions 创建和批准拉取请求”设置 GitHub Actions PR 创建失败

avi*_*ano 66

您可能正在使用组织,这意味着您必须首先在组织级别启用此行为,然后在存储库级别启用此行为

  1. 转到https://github.com/organizations/YOUR_ORG/settings/actions并检查Allow GitHub Actions to create and approve pull requests
  2. 然后转到https://github.com/YOUR_ORG/YOUR_REPO/settings/actions并选中之前呈灰色的框

  • 0. 如果您使用的是 GitHub Enterprise,则还需要选中该复选框 https://github.com/enterprises/YOUR_ENTERPRISE/settings/actions 另外,在企业。 (7认同)
  • 太好了谢谢!在我的情况下,似乎不需要步骤 2,因为我猜它已经通过第一步进行了检查。 (3认同)