mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-14 11:54:28 +01:00
We're changing what's been done as part ofac939c458c, as we've notcied issues using `github.event.pull_request.merge_commit_sha`. Basically, whenever a force-push would happen, the reference of merge_commit_sha wouldn't be updated, leading us to test PRs with the old code. :-/ In order to get the rebase properly working, we need to ensure we pull the hash of the commit as part of checkout action, and ensure fetch-depth is set to 0. Fixes: #7414 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com> (cherry picked from commitbd24afcf73)
38 lines
769 B
Bash
Executable File
38 lines
769 B
Bash
Executable File
#!/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 "$@"
|