Merge pull request #7874 from fidencio/topic/manually-rebase-branches-atop-of-the-target-one

gha: Manually rebase PR atop of the target branch before testing
This commit is contained in:
GabyCT
2023-09-11 10:35:01 -06:00
committed by GitHub
20 changed files with 258 additions and 4 deletions

37
tests/git-helper.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
#
# Copyright (c) 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set -o errexit
set -o nounset
set -o pipefail
function add_kata_bot_info() {
echo "Adding user name and email to the local git repo"
git config user.email "katacontainersbot@gmail.com"
git config user.name "Kata Containers Bot"
}
function rebase_atop_of_the_latest_target_branch() {
if [ -n "${TARGET_BRANCH}" ]; then
echo "Rebasing atop of the latest ${TARGET_BRANCH}"
git rebase origin/${TARGET_BRANCH}
fi
}
function main() {
action="${1:-}"
add_kata_bot_info
case "${action}" in
rebase-atop-of-the-latest-target-branch) rebase_atop_of_the_latest_target_branch;;
*) >&2 echo "Invalid argument"; exit 2 ;;
esac
}
main "$@"