首页 > 解决方案 > 当分支需要拉取请求时如何提交到主分支

问题描述

我有几个 GitHub 项目,当主分支使用功能分支更新时,它们会影响构建版本。

脚本通常会git commit像这样从命令行执行:

if ! git diff-files --quiet
then
  echo "Using pattern: '$INPUT_PATTERN' and commit message: $INPUT_COMMIT_MESSAGE"

  git status | grep -v "Your branch is" | grep -v "Changes not staged" | grep -v "(use \"git"
  git add "$INPUT_PATTERN"
  git commit -m "$INPUT_COMMIT_MESSAGE" 2> /dev/null || true

  git push 2> /dev/null
else
  echo "No difference detected in $GITHUB_REPOSITORY, did not use pattern: $INPUT_PATTERN"
fi

为了做到这一点,分支在合并之前不能要求拉取请求。如果主分支必须有拉取请求,这怎么可能呢?如果它们必须在合并前进行审查?

标签: githubgithub-actions

解决方案


推荐阅读