绕过检查:允许检查 PR 外的提交,修复绕过检查

This commit is contained in:
Wenxuan Zhao 2018-10-23 21:27:21 -07:00
parent a31b145df9
commit d77d2bc64e
No known key found for this signature in database
GPG Key ID: 0B45B13F10587A57

View File

@ -14,11 +14,13 @@ echo "[收集] 计算 PR 分支与目标分支的分叉点……"
TARGET_BRANCH="${TRAVIS_BRANCH:-master}"
echo "[收集] 目标分支设定为:${TARGET_BRANCH}"
MERGE_BASE="$(git merge-base "$TARGET_BRANCH" FETCH_HEAD)"
MERGE_BASE='HEAD^'
[ "$TRAVIS_PULL_REQUEST" != 'false' ] \
&& MERGE_BASE="$(git merge-base "$TARGET_BRANCH" HEAD)"
echo "[收集] 找到分叉节点:${MERGE_BASE}"
{
git log --oneline "${MERGE_BASE}..FETCH_HEAD" | grep -Eq '^绕过检查' && {
git log --oneline "${MERGE_BASE}..HEAD" | grep -Eq '绕过检查' && {
touch /tmp/bypass
echo "[收集] 已标记为绕过检查项"
}
@ -26,7 +28,7 @@ echo "[收集] 找到分叉节点:${MERGE_BASE}"
echo "[收集] 写出文件变更列表……"
git diff "$MERGE_BASE" FETCH_HEAD --no-renames --name-status > /tmp/changes
git diff "$MERGE_BASE" HEAD --no-renames --name-status > /tmp/changes
echo "[收集] 已写出文件变更列表:"
cat /tmp/changes
{ [ -z "$(cat /tmp/changes)" ] && echo "(无变更)"; } || true