我已经配置了我的存储库,使得 GitHub actions 能够批准 PR。
我有分支保护规则,要求在合并之前进行1次批准。
然而,接下来的步骤失败了。
(这个)公关确实被批准了,但合并失败了。
如何允许
更新1:
移除了
- name: perform the merge if applicable
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
echo "Approving PR..."
gh pr review --approve ${{ github.event.issue.number }}
echo "Merging PR..."
gh pr merge ${{ github.event.issue.number }} --admin --squash
(这个)公关确实被批准了,但合并失败了。
Approving PR...
Merging PR...
Message: You're not authorized to push to this branch. Visit https://docs.github.com/articles/about-protected-branches/ for more information., Locations: [{Line:1 Column:58}]
如何允许
github-actions
机器人合并 PR?更新1:
移除了
--admin
标志,以防万一。Approving PR...
Merging PR...
X Pull request #199 is not mergeable: the base branch policy prohibits the merge.
To have the pull request merged after all the requirements have been met, add the `--auto` flag.
To use administrator privileges to immediately merge the pull request, add the `--admin` flag.
更新2
我已经将以下权限添加到GITHUB_ACTIONS
令牌中,但没有任何效果
permissions:
contents: write
pull-requests: write
repository-projects: write
gh pr merge
命令中删除--admin
标志了吗?据我所知,GH action无法使用其默认的GH_TOKEN执行管理员任务。 - tjarbo--auto
标志吗? - tjarbo--auto
标志。另外,您对分支策略有哪些要求? - tjarbo