Skip to content

Commit

Permalink
ci: rebase before running samples check
Browse files Browse the repository at this point in the history
This removes the need for PR author to rebase feature branch for updated samples in target branch, if any

Signed-off-by: Saul Paredes <[email protected]>
  • Loading branch information
Redent0r committed Nov 14, 2024
1 parent 52039cb commit 3ce4d08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/check-samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Rebase atop of the latest target branch
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
run: |
./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch"
- name: Install yq
env:
INSTALL_IN_GOPATH: false
Expand Down
2 changes: 2 additions & 0 deletions tests/git-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
set -o errexit
set -o nounset
set -o pipefail
set -x

function add_kata_bot_info() {
echo "Adding user name and email to the local git repo"
Expand All @@ -21,6 +22,7 @@ function rebase_atop_of_the_latest_target_branch() {
echo "Rebasing atop of the latest ${TARGET_BRANCH}"
# Recover from any previous rebase left halfway
git rebase --abort 2> /dev/null || true
git fetch origin ${TARGET_BRANCH}
git rebase origin/${TARGET_BRANCH}
fi
}
Expand Down

0 comments on commit 3ce4d08

Please sign in to comment.