gpt4 book ai didi

github - Dependabot 生成的 Pull Request 与 codeowners 文件和分支保护规则的自动合并?

转载 作者:行者123 更新时间:2023-12-05 01:25:50 26 4
gpt4 key购买 nike

我已经按照此处所述为 GitHub Actions 创建了工作流:https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions

    name: Dependabot auto-approve
on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
# The documentation incorrectly forgets `GITHUB_TOKEN` here.
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

上述自动化工作正常,但我有一个分支保护规则需要代码所有者审核。

有没有办法将 github-actions 包含到 CODEOWNERS 文件中,以便计算其批准?

最佳答案

截至目前,GitHub 应用无法添加到 CODEOWNERS 中,如引用 here .

Thank you for being here! Currently, GitHub Apps can’t be used in CODEOWNERS – that’s not supported. It’s something the team is considering for the future, and I’ll be sure to add your use case to the internal feature request.

但是,您可以按照说明使用自己生成的 GitHub 个人访问 token in the documentation here ,然后将其添加为 secret 并在您的工作流程中使用它。查看GitHub Documentation .

然后,您操作的最后一步将引用您自定义的 secret 。在下面的例子中,我假设它叫做 MYTOKEN

          - name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
# The documentation incorrectly forgets `GITHUB_TOKEN` here.
GITHUB_TOKEN: ${{secrets.MYTOKEN}}

使用这种方法,合并将作为您的用户完成,我假设他是 CODEOWNERS 的一部分。

关于github - Dependabot 生成的 Pull Request 与 codeowners 文件和分支保护规则的自动合并?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70664840/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com