From 2de7310cbaf9a938fd9332a3bf33cf865f1990af Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Thu, 7 Jul 2022 15:40:20 -0700 Subject: [PATCH] Use command group instead of || followed by && --- .../actions/composite/updateProtectedBranch/action.yml | 7 ++++--- tests/unit/getPullRequestsMergedBetweenTest.sh | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/actions/composite/updateProtectedBranch/action.yml b/.github/actions/composite/updateProtectedBranch/action.yml index 44bbfe8947a7..892c6cd27eca 100644 --- a/.github/actions/composite/updateProtectedBranch/action.yml +++ b/.github/actions/composite/updateProtectedBranch/action.yml @@ -68,9 +68,10 @@ runs: git checkout ${{ inputs.TARGET_BRANCH }} BRANCH_NAME=update-${{ inputs.TARGET_BRANCH }}-from-${{ env.SOURCE_BRANCH }} git checkout -b "$BRANCH_NAME" - git merge -Xtheirs ${{ env.SOURCE_BRANCH }} \ - || git diff --name-only --diff-filter=U | xargs git rm \ - && git merge --continue + git merge -Xtheirs ${{ env.SOURCE_BRANCH }} || { + git diff --name-only --diff-filter=U | xargs git rm; + git merge --continue; + } git push --set-upstream origin "$BRANCH_NAME" - name: Create Pull Request diff --git a/tests/unit/getPullRequestsMergedBetweenTest.sh b/tests/unit/getPullRequestsMergedBetweenTest.sh index 2aab142642f0..84c29d333bff 100755 --- a/tests/unit/getPullRequestsMergedBetweenTest.sh +++ b/tests/unit/getPullRequestsMergedBetweenTest.sh @@ -117,7 +117,7 @@ success "Version bumped to $(print_version) on main" info "Merging main into staging..." git checkout staging git checkout -b update-staging-from-main -git merge --no-edit -Xtheirs main || git diff --name-only --diff-filter=U | xargs git rm && git merge --continue +git merge --no-edit -Xtheirs main || { git diff --name-only --diff-filter=U | xargs git rm; git merge --continue; } git checkout staging git merge update-staging-from-main --no-ff -m "Merge pull request #3 from Expensify/update-staging-from-main" info "Merged PR #3 to staging" @@ -219,7 +219,7 @@ title "Scenario #4A: Run the production deploy" info "Updating production from staging..." git checkout production git checkout -b update-production-from-staging -git merge --no-edit -Xtheirs staging || git diff --name-only --diff-filter=U | xargs git rm && git merge --continue +git merge --no-edit -Xtheirs staging || { git diff --name-only --diff-filter=U | xargs git rm; git merge --continue; } git checkout production git merge update-production-from-staging --no-ff -m "Merge pull request #8 from Expensify/update-production-from-staging" info "Merged PR #8 into production" @@ -250,7 +250,7 @@ success "Successfully updated version to 1.1.0 on main!" info "Updating staging from main..." git checkout staging git checkout -b update-staging-from-main -git merge --no-edit -Xtheirs main || git diff --name-only --diff-filter=U | xargs git rm && git merge --continue +git merge --no-edit -Xtheirs main || { git diff --name-only --diff-filter=U | xargs git rm; git merge --continue; } git checkout staging git merge update-staging-from-main --no-ff -m "Merge pull request #10 from Expensify/update-staging-from-main" info "Merged PR #10 into staging" @@ -299,7 +299,7 @@ success "Bumped version to 1.1.1 on main!" info "Merging main into staging..." git checkout staging git checkout -b update-staging-from-main -git merge --no-edit -Xtheirs main || git diff --name-only --diff-filter=U | xargs git rm && git merge --continue +git merge --no-edit -Xtheirs main || { git diff --name-only --diff-filter=U | xargs git rm; git merge --continue; } git checkout staging git merge update-staging-from-main --no-ff -m "Merge pull request #13 from Expensify/update-staging-from-main" info "Merged PR #13 into staging"