无法计算我的 github 状态检查操作的操作

Unable to figure operation of my github status check operation

这是我的受保护分支(master)配置:

这就是我尝试过的:

$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 306 bytes | 306.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: Required status check "build-pipeline" is expected.
To github.com:AdityaGovardhan/my-repo.git
 ! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'git@github.com:AdityaGovardhan/my-repo.git'

所以我有一个 github my-repo 存储库。我有一个 build-pipeline GitHub 操作,我已根据需要保留该操作,以便将提交添加到 master。以下是所需的检查声明:

Choose which status checks must pass before branches can be merged into a branch that matches this rule. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed.

这就是我所期望的。由于 最后一条语句^,我可以直接从我的本地主机推送到远程主机(受保护),但提交将在远程的中间状态,因为 build-pipeline 状态检查尚未成功。我知道那不是 git 的工作方式。但是, 最后一条语句 ^ 迫使我创建一个不受保护的分支并提出拉取请求以执行 build-pipeline状态检查,然后合并到master。

在 GitHub,状态检查应用于提交。虽然典型的工作流程是打开一个 PR 并以这种方式合并更改,但可以将您的更改推送到不同的分支,让状态检查 运行 在那里,然后快进您的 master分支到那个版本。提交已经通过了检查。

请注意,我还没有对此进行测试,而且这不是通常的工作流程,您可以尝试一下。对于进行变基并喜欢线性历史记录的人来说,这将是一个潜在的工作流选项。