diff --git a/.github/workflows/test-apps.yml b/.github/workflows/test-apps.yml index 73b63d252a..f7d5263733 100644 --- a/.github/workflows/test-apps.yml +++ b/.github/workflows/test-apps.yml @@ -1,4 +1,4 @@ -name: "Test random 💯" +name: "Test random 💯 2.0 T" env: TERM: xterm @@ -48,11 +48,18 @@ jobs: else git checkout testing fi + last_commit_hash=$(git log -n 1 --format=%H) git fetch origin main if [[ $(git rev-list HEAD...origin/main --count) -gt 0 ]]; then echo "Changes detected between 'main' and 'testing'. Rebasing..." - git merge origin/main --no-edit - git push origin testing + git rebase origin/main + if [ $? -ne 0 ]; then + echo "Rebase failed. Attempting to resolve conflicts." + git rebase --abort + exit 1 + fi + git cherry-pick $last_commit_hash + git push origin testing --force-with-lease fi if [[ $GITHUB_REF == refs/pull/* ]]; then echo "This is Pull Request. No saving results." @@ -298,8 +305,17 @@ jobs: if [[ $GITHUB_REF == refs/pull/* ]]; then echo "This is Pull Request. No saving results." else - git commit -m "update results" - git push origin testing + last_commit_branch=$(git rev-parse --abbrev-ref HEAD) + last_commit_message=$(git log -1 --pretty=%B) + if [[ "$last_commit_branch" == "main" || "$last_commit_message" == *"merge main"* ]]; then + echo "Last commit is from main. Creating a new commit." + git commit -m "update results" + git push origin testing + else + echo "Last commit is from testing. Amending last commit." + git commit --amend --no-edit --date "$(date)" + git push origin testing --force-with-lease + fi fi fi