From c776379fb6613bcc794dd2be8a6c4c006bf89931 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Fri, 1 Dec 2023 20:01:31 +0000 Subject: [PATCH] workflows/sorbet: fix pull request testing --- .github/workflows/sorbet.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index 6a7b0fff19..a08a8bfab0 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -47,17 +47,20 @@ jobs: id: update working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} run: | - git fetch origin - - BRANCH="sorbet-files-update" - echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT" - - if git ls-remote --exit-code --heads origin "${BRANCH}" + if [[ "${GITHUB_EVENT_NAME}" != "pull_request" ]] then - git checkout "${BRANCH}" - git checkout "Library/Homebrew/sorbet" - else - git checkout --no-track -B "${BRANCH}" origin/master + git fetch origin + + BRANCH="sorbet-files-update" + echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT" + + if git ls-remote --exit-code --heads origin "${BRANCH}" + then + git checkout "${BRANCH}" + git checkout "Library/Homebrew/sorbet" + else + git checkout --no-track -B "${BRANCH}" origin/master + fi fi brew typecheck --update --suggest-typed