jenkins - 在 GitHub 中,我如何授予应用程序权限以提交到具有保护的分支?

标签 jenkins github git-push github-app

我有一个应用程序,我想在 CI 构建期间升级版本。我正在尝试使用应用凭据将版本回退,但出现以下错误:

+ git push origin HEAD:master
remote: error: GH006: Protected branch update failed for refs/heads/master.        
remote: error: At least 1 approving review is required by reviewers with write access.

现在,当我使用自己的凭据执行此操作时,它可以正常工作,因为我是存储库中的管理员,但是尽管有通常的分支保护,我如何授予对应用程序的访问权限以推送到 master?

最佳答案

您可以(现在,2022 年 5 月,18 个月后)。

Consistently allow GitHub Apps as exceptions to branch protection rules

Previously, some branch protections only allowed exceptions to be granted to users and teams.
Now, GitHub Apps can also be granted exceptions to any branch protection that supports exceptions.

Admins can create branch protection rules to enforce certain workflows for branches, such as requiring a pull request before changes can be merged to a branch.

This is a good practice, but you may want to make exceptions to a rule for specific people, teams, or GitHub Apps.
For example, if you have a GitHub App that calls GitHub APIs to make changes in a repository, you may want to permit that App to make changes without creating a pull request.

Previously, these exceptions could be granted to people and teams, but only some protections allowed GitHub Apps.

Now, branch protections that previously only allowed exceptions for people and teams also support GitHub Apps.
When admins configure these branch protections, they can choose from a list of GitHub Apps that are installed and authorized for the repository, as shown here:

Image of adding a GitHub App as an exception to a branch protection setting -- https://i0.wp.com/user-images.githubusercontent.com/1767415/168915626-eaccb112-d95f-4828-bbfd-317844aa6cda.png?ssl=1

(Image of adding a GitHub App as an exception to a branch protection setting)

For information about branch protection rules, visit Managing a branch protection rule.

For information about GitHub Apps, visit About GitHub Apps.

关于jenkins - 在 GitHub 中,我如何授予应用程序权限以提交到具有保护的分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65348124/

相关文章:

amazon-web-services - Jenkins ECS 和 EFS 出错

git - 防止 "git push origin -prune"?

maven - 如何仅在发行版中从Jenkins发送电子邮件?

java - ANT 构建中未生成类文件

jenkins - 输入步骤超时,使用Jenkins管道以默认设置继续

git - 如何使用GitHub的在线比较 View 来显示两个分支的 "just the file contents"的差异?

git - 如何在一个系统中配置两个具有不同凭据的不同 git repo?

android - 通过 react native 添加 map

git - `receive.denyCurrentBranch=updateInstead` 如何与索引交互?

git - 无论我做什么,我都无法推送我的代码并不断收到相同的错误