From 4b705bb7db80c5a48d6536b7f0344ed6a5295b06 Mon Sep 17 00:00:00 2001 From: Miriam Goldman Date: Mon, 29 Jul 2024 15:41:44 -0400 Subject: [PATCH] use rebase from hoover --- .github/workflows/standard-workflow.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/standard-workflow.yml b/.github/workflows/standard-workflow.yml index 6043fe9f..87030f5f 100644 --- a/.github/workflows/standard-workflow.yml +++ b/.github/workflows/standard-workflow.yml @@ -114,15 +114,25 @@ jobs: - name: Push branch to Pantheon run: | + curr_branch=$( git branch --show-current ) # The dev environment is always based on the master branch - branch=$( [ "$env" == "dev" ] && echo "master" || echo "$env" ) + dest_branch=$( [ "$env" == "dev" ] && echo "master" || echo "$env" ) + + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + git checkout ${{ github.head_ref }} + fi # Configure git to use the SSH key and avoid host key checking git config --local core.sshCommand 'ssh -i ~/.ssh/pantheon -o StrictHostKeyChecking=no' + git config --local user.email "gh-actions@pantheon.io" + git config --local user.name "GitHub Actions" + git remote add pantheon $(terminus connection:info ${{ vars.SITE_NAME }}.$env --field=git_url) - git fetch --all - echo "Pushing to $env" - git push pantheon ${{ github.ref_name }}:$branch --force + git fetch pantheon + git checkout -b $dest_branch + git pull pantheon $dest_branch --rebase + git status + git push pantheon $dest_branch spin_down: name: Spin down